Search code examples
stringtableau-api

Tableau Calculated Field to extract characters from an existing field


I am trying to use a Tableau calculated field to extract the 5th - 8th (inclusion) character from an existing Tableau field. All of the ID numbers are as follows:

LWZ-2017-32498

I am trying to write a calculated field to extract the 2017 portion from the above example. I am trying to use an if statement, but I have having a hard time finding a Tableau function to extract the string 2017. Any suggestions?


Solution

  • Using MID([column_name, 5, 4) should do the trick. Just be sure to change out column name for the actual name of your data field.