Forum Discussion

STs2207's avatar
STs2207
Frequent Visitor
8 years ago
Solved

If then else old value

Hi,

 

I would like to transform the data in one column as follows but cannot find a way to do it. I want to find the cells that start with abc and replace the content of the cell with abc, otherwise leave it as it is.

 

if (contains ([column2], "abc"), then "abc", else return existing string

 

Thanks in advance

  • Hi STs2207,

     

    You can use this formula in Query Editor for power Query or use the LEFT function in DAX :

     

    if Text.Contains([Column2], "abc") then "abc" else [Column2])
    
    

    Hope it helps...

     

    Ninter

     

2 Replies

  • Hi STs2207,

     

    You can use this formula in Query Editor for power Query or use the LEFT function in DAX :

     

    if Text.Contains([Column2], "abc") then "abc" else [Column2])
    
    

    Hope it helps...

     

    Ninter