Lead magnet - project 1.png
  • Bernard

The MID Function in Tableau


The Syntax

MID (String, Start, Length)

This function returns the characters in a string starting at index position ‘start’. Note, the first character in a string is position 1. If the optional argument ‘length’ is added, the returned string includes only the number of characters specified.

For example.

MID (“Dashboards”,5) = “boards” (returns all characters starting at position 5)

MID (“Dashboards”,2 ,3) = “ash” (returns 3 characters starting at position 2)

Use case of MID function in Tableau

There are several ways you can use the MID function in Tableau.

One way is when converting a string into title case.

E.g. Converting the string ‘dashboards’ into ‘Dashboards’ using the following calculation.

UPPER(LEFT(“dashboards”,1)) + MID(“dashboards”,2)

Another way you can use the MID function is when extracting the username from a twitter handle.

E.g. extracting the username “rigordatasolns” from the twitter handle “@rigordatasolns” using the following calculation.

MID (“@rigordatasolns”,2) = “rigordatasolns”

I hope this short article was helpful to you. To receive more of the Tableau tips, kindly join our mailing list by subscribing below.

Thank you for reading.