Trim Function in Alteryx

by Charlie Daffern

Here’s a tip I found to meet a need in preparing my gymnastics data set. I downloaded the data in a hideous PDF format, and so there was a good amount of cleaning that needed doing. The ‘Trim’ function came in very useful for sorting out the Nationality field.

The first image shows the format that Nationality was in when initially extracted from the PDF file. There’s a lot of unnecessary leading space, and a useless addition of ‘D E’ to the end of each field.
 This is where Trim comes in useful. The format for this function according to Alteryx is ‘Trim(String,y)’ – where ‘String’ is the thing you want to clean up (in this case the Nationality field) and ‘y’ is the thing you want cleaning from that field (in this case the rogue ‘D E’ that has been appended to each nationality). Therefore, the function that I write into my formula field is: Trim([Nationality],’D E’). You can see the results of this formula tool in the following image.

If you leave the ‘y’ of the Trim function blank, it will default to trimming blanks. I used this to remove the left-over unnecessary spaces from the Nationality field, as you can see in the final image.

Along the tabs at the top of the page you can also see the three different iterations of this workflow that I’ve come up with (so far…) to get the data into the best possible format for using in Tableau. Lots of learning in going through the failed iterations!

Avatar

Charlie Daffern

Fri 15 Dec 2017

Fri 15 Dec 2017

Tue 12 Dec 2017