Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
STs2207
Frequent Visitor

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

1 ACCEPTED SOLUTION
Interkoubess
Solution Sage
Solution Sage

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

 

View solution in original post

2 REPLIES 2
Interkoubess
Solution Sage
Solution Sage

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

 

Thank you very much @Interkoubess

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.