Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi
I have query with 3 columns: InvoiceNumber, InvoiceType and InvoiceAmount. There are 40K+ records, and half a dozen of them have the wrong InvoiceType (need to change com "Service" to "Product"
So, I put up this code:
replaceType =
if "InvNumber" = "30881" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "30769" and "InvType" = "Service" then Table.ReplaceValue(PreviousStep, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "30770" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "30771" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "30772" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "30791" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "31261" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "31262" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "31336" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else if "InvNumber" = "31337" and "InvType" = "Service" then Table.ReplaceValue(replaceCarga, "Service", "Product", Replacer.ReplaceText, {"InvType"})
else "InvType"="InvType"
in
replaceType
The thing is it is not working at all. I don't know how to instruct a "do nothing" in the last else. Any ideas?
Is this query a custom function or others? Which error occurs when you implement it?
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi
It's the standard replace value function from power query. The point is that I cannot make it work with if statements inside it.
I believe you can also create a quick table of replacements and then merge the 2 fields of both tables
| InvNumber | InvType | Correct Replacement |
| 30881 | Service | Product |
| 30769 | Service | Product |
| 30770 | Service | Product |
Zubair, that seems to be the easier way to go, thanks for that. I'll use it, because in the end of the day, it solves the problem.
In the meantime I really wanted to improve my "IF" skills. This "do nothing' at the end of the if then else statement is really troublesome. Let's see if somebody come up with an insight on that.
Best regards,
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |