Transform Your Data in Seconds: A Step-by-Step Guide to Using Tableau Prep’s Replace Feature

Effortlessly Replace Characters and Clean Your Data with Tableau Prep’s Replace Feature

cengkuru michael
2 min readJan 11, 2023
Photo by PAN XIAOZHEN on Unsplash

In Tableau Prep, you can easily replace characters in a field using the “Replace” step. The process is simple and straightforward and can be done in a few steps.

  1. Drag the “Replace” step to your flow.
  2. Select the field you want to edit by clicking on the field name in the left pane.
  3. In the “Find” field, enter the characters you want to replace. In the “Replace” field, enter the characters you want to replace them with.
  4. You can also use regular expressions to match specific patterns of characters by checking the “Use Regular Expression” box.
  5. Once you have entered the necessary information, click the “Run” button to apply the replace step to your data.

Example: Let’s say you have a column named “City” and you want to replace all instances of “Saint” with “St.”. In this case, you would select the “City” column, enter “Saint” in the “Find” field, and “St.” in the “Replace” field. After clicking the “Run” button, all instances of “Saint” in the “City” column would be replaced with “St.”

Alternative ways of replacing Characters

Using Formulas

One way is to use the “Formula” step to create a new calculated field that replaces the characters. This can be done using the REPLACE() function, replacing a specified sequence of characters in a string with another set of characters.

Here’s an example of how you could use the REPLACE() function in a formula step:

  1. Drag the “Formula” step to your flow
  2. create a new field name, for example, ‘replace_city’
  3. In the formula field, enter the following formula: REPLACE([City], “Saint”, “St.”)
  4. Run the step, and the new field will have the replacement made.

Text to Column

Another way to replace characters in a field in Tableau Prep is to use the “Text to Column” step, which allows you to split a field into multiple columns based on a delimiter. Once the field has been split, you can edit the individual columns and recombine them using the “Join” step. This method can be useful if you want to replace characters within a specific part of a field.

It’s also worth mentioning that you can use other 3rd parties tools like excel or other scripting tools like python to achieve the same goal, depending on your dataset's size and complexity and your familiarity with that tool.

--

--

cengkuru michael

I turn data into meaningful stories by analyzing and visualizing information to create a cohesive narrative. Love helping others see the world in a new light.