Strings and Calculated fields

A string is a sequence of characters such as letters and words. A calculated field allows us to create new data fields with the data we already have. When performing calculations using strings, tableau has a range of functions we can use. Some commonly used calculated fields include:

Replace: takes a substring within a string and replaced it with the desired string.

Trim: returns a string with spaces in the left, right or both removed.

Left/ Right: returns a specified number of characters from the left/ right.

Split: separates a string into two substrings based on a common separator (e.g. :).

Upper/ lower: converts the string into upper/ lower cases.

Returns a Boolean if a string contains a substring.

There are a number of different functions we can use to manipulate strings. The fields we use vary depending on the program we are using. For example to use the replace in function on tableau we would do: 'Replace(string, substring, replacement) whilst on PBI we use 'Text.Replace' and on SQL we use 'SELECT REPLACE (string, substring, replacement). The language used in SQL is the most different compared to PBI and Tableau.

If we are unsure about which function to use, we can search the function to see what it does and how to use it. By clicking on the tiny arrow between the grey box and the white box we can show/ hide the extra information given by the function.

This can help us decide the correct calculation to use for our desired result.

Author:
Saampave Sanmuhanathan
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab