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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

ReplaceValue with two conditions

Hi!
I have a table with a column "Reasons" that contains text and null values. In this table I also have "Reasons_id" column. The thing is that I want to replace null values in "Reasons" that have Reasons_id = 150.  And replace them with the text "Approved".

I tried this one but it doesn't work.
= Table.ReplaceValue(#"Removed Duplicates", each [Reasons] , each if [Reasons_id]= 150 and [Reasons] = null then "Approved" else [Reasons], Replacer.ReplaceText,{"Reasons"})

Interestengly, it displays no error but returns me a table as it was before. No changes. It didn't replace  null values with id = 150. What did I do wrong? Thank you a lot for your help in advance. 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try changing Replacer.ReplaceText with Replacer.ReplaceValues.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try changing Replacer.ReplaceText with Replacer.ReplaceValues.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.