What does REPLACE function do in Tableau?
beginnerAnswer
`REPLACE(string, substring, replacement)` searches a string for a substring and substitutes it, returning the modified string. The original field is unchanged.
`REPLACE([Product Name], 'Corp.', 'Corporation')` standardises a naming variation across a column.
It is a string function, which is worth stating explicitly because interviewers sometimes ask it next to `ZN()` to see whether you confuse the two — `ZN()` converts a null number to zero and has nothing to do with strings.
Where several substitutions are needed, nesting `REPLACE` gets unreadable quickly; a `CASE` statement or a group is usually the better answer. String operations are also among the slower calculation types, so bulk cleaning belongs upstream in Prep or the warehouse.
Related questions