From the course: Tableau: Mastering Calculations

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Splitting and replacing strings

Splitting and replacing strings - Tableau Tutorial

From the course: Tableau: Mastering Calculations

Splitting and replacing strings

Let's continue for a bit with the example of the phone number. Again, our phone numbers consist of an area code and a local number, and these both aspects are separated by a space. Our goal is now to separate the area code and local number. This is easiest with the split feature. Let's take a look. We can right-click on "Phone", and "Transform", and "Split". Or we could also use a custom split. In our case, we want to separate at the space and split off the last column from the end. Let's click "OK" and drag this field into the view. We can see this now contains the local number. But what actually happens behind the scenes? Let's take a deeper look. Let's right-click and edit this new split field. We can see that Tableau uses two functions, SPLIT and TRIM. SPLIT returns a substring from a string as determined by the delimiter. So our delimiter is the space. TRIM will be used to return the string with both leading and trailing spaces removed. So a clean-up function. Let's recreate it…

Contents