Tableau Calculated Field to extract characters from an existing field

Viewed 91

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?

2 Answers

Have you tried MID? MID([data],5,4)

data --> references your column

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.

Related