Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I'm trying to write a query to replace text but only based on values of another column. Example:
| Main | Side | Drink | Price |
| Burger | Soda | 5.00 | |
| Fries | Soda | 2.00 | |
| Burger | Fries | Soda | 7.00 |
| Salad | 2.50 | ||
| Salad | Apple | 3.00 |
I want to replace the blanks in [Drink] with "Orange Juice" only if [Main] = "Salad" and [Side] = "Apple". Using the GUI and simply replacing texts didn't help me since it still filled all the blanks in [Drink]. Not sure how to procede and I'd rather avoid creating a calculated column
Solved! Go to Solution.
Hi @powerbiuser101,
1. In the Query Editor, right click the blanks in the column Drink, then select Replace Values. Enter 1 to the Replace with.
2. Open the Advanced Editor. Replace the 1 with the code below.
each if [Main] = "Salad" and [Side] = "Apple" then "Orange Juice" else " "
Best Regards,
Dale
Hi there,
I am trying to replace values in a column where if value is M is replaced by Para Assement and when its 17 it should be replaced with Master's Degree, but when I replace M by Para Assement then it also replaces and overrites all values in 17 as 'Para Assementaster's Degree'.
How to correct this now. Please help
Thanks.
Hi @powerbiuser101,
Could you please mark the proper answer as the solution?
Best Regards,
Dale
Hi @powerbiuser101,
1. In the Query Editor, right click the blanks in the column Drink, then select Replace Values. Enter 1 to the Replace with.
2. Open the Advanced Editor. Replace the 1 with the code below.
each if [Main] = "Salad" and [Side] = "Apple" then "Orange Juice" else " "
Best Regards,
Dale
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |