Select Page

Consider the following scenario,

If we need to split these Customer Names into three columns with First Name, Middle Name and Last Name Columns, how do we achieve it in Tableau?

Also, I have written another blog on the Alteryx way of solving the problem.

This can be done through writing calculated fields.

Below are three calculated fields I discovered that work quite well in solving this problem.

Calculated field one:

//Customer First Name

TRIM( SPLIT( [Customer Name], ” “, 1 ) )

Calculated field two:

//Customer Middle Name

IF LEN([Customer Name]) – LEN(REPLACE([Customer Name],” “,””)) > 1 then

//Check if there are more than one spaces indication of a middle name present

TRIM( SPLIT( [Customer Name], ” “, 2 ) )

ELSE

“”

END

Calculated field three:

//Customer Last Name

IF LEN([Customer Name]) – LEN(REPLACE([Customer Name],” “,””)) > 1 then

//Check if there are more than one spaces indication of a middle name present.

TRIM( SPLIT( [Customer Name], ” “, 3 ) )

ELSE

TRIM( SPLIT( [Customer Name], ” “, 2 ) )

END

Try out yourself! This works for me and should work for you too!