Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to replace substring in If condition in Power query

iddescription
1123acx
1123acx
2456qwe

 

Hi,

i want to replace 123 to 789(or first 3 value to another 3 value), if the id column == 1, and "acx" remains.  how should i code in power query?  Very appreciate your help!

  • Anonymous 

    if [id]=1 and Text.Contains([description],"acx") then Text.Replace([description],"123","789") else [description]

2 Replies

  • smpa01's avatar
    smpa01
    Community Champion

    Anonymous 

    if [id]=1 and Text.Contains([description],"acx") then Text.Replace([description],"123","789") else [description]
    • Anonymous's avatar
      Anonymous
      Not applicable

      Great! thanks for your solution. it works!