cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

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!

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Anonymous 

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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


View solution in original post

2 REPLIES 2
smpa01
Super User
Super User

@Anonymous 

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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


Anonymous
Not applicable

Great! thanks for your solution. it works!

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors