How to replace a string to an arbitrary string conditionally in Tableau Desktop

Published: 24 May 2022
Last Modified Date: 26 May 2022


How to convert text strings to an arbitrary string if there is a string that matches a condition.

If the data contains "data", then the data should be converted to "Data Rockstar" as follows.
User-added image


  • Tableau Desktop


1. Connect to Sample_data.xlsx.
2. Drag [No.] and [Data] to Rows.
3. Create a new parameter as following settings.
User-added image
4. Right click on [Parameter 1] -> Show parameter
    //Enter the string you want to search for in this parameter.
5. Create a new Calculated field as following settings.
    Name : Converter
    Calculation : IF CONTAINS([Data],[Parameter 1])
                         THEN "Data Rockstar"
                         ELSE [Data]
6. Drag [Converter] to Text.
Did this article resolve the issue?