Search code examples
powerquerym

How to replace more values in one column


I am trying to replace 3 values in one column, but I would like to do it in one step instead of three steps. I don't want to have Replaced Value1, Replaces Value2 and Replaced Value 3.

Imagine you have in column Cars only these values: Volkswagen, Renault and Dacia. You want to replace them like:

Volkswagen --> VW
Renault --> RN
Dacia --> DC

Is it possible to do it in one step instead of 3? I am trying to use statement Table.ReplaceValue

Many thanks


Solution

  • Similar to @Aleksei's answer, you can use the Table.ReplaceValue function instead if you prefer:

    = Table.ReplaceValue(YourTable, each [Car], each RenameCars{[Name = [Car]]}[Name_mod], Replacer.ReplaceText, {"Car"})
    

    This assumes you have the RenameCars table as well.