Forum Discussion

cristianml's avatar
cristianml
Post Prodigy
3 years ago
Solved

Replace multiple string values query editor

Hi,

 

I want to replace multiple strings values from a column in one single step in query editor.

 

I tried the following but is not working:

 

#"Replaced China/Hong Kong" = Table.ReplaceValue(#"Removed Errors",
each [Country] = "China/Hong Kong","China",
[Country] = "China/Mainland","China",
[Country] = "China/Taiwan","China",
Replacer.ReplaceText,{"Country/Location"}),

 

 

I need to replace the following strings with "China":

 

"China/Hong Kong"

"China/Mainland"

"China/Taiwan"

 

Any ideas ?

 

 

Thanks !!

  • Hi cristianml ,

     

    According to your description, here is my solution.

    It cannot work if you replace multiple different values in a column at the same time. You can use "repalce value" three times in advanced editor.

    Or you can create custom columns. If you want to replace all areas related to China with "China", please use "contain".

     

    Best Regards,
    Community Support Team _ xiaosun

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-xiaosun-msft's avatar
    v-xiaosun-msft
    Community Support

    Hi cristianml ,

     

    According to your description, here is my solution.

    It cannot work if you replace multiple different values in a column at the same time. You can use "repalce value" three times in advanced editor.

    Or you can create custom columns. If you want to replace all areas related to China with "China", please use "contain".

     

    Best Regards,
    Community Support Team _ xiaosun

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.