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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Query Editor - replace multiple values

Hello -  Our ERP system captures input for who took an order....but the input is the person's initials.  

 

I have about 40 of these two change....but don't want a giant list of "Replaced Value" in my query editor steps.    Here are the first two, but I am not sure how to apply all of these steps into ONE step in the advanced query editor?    

 

= Table.ReplaceValue(#"Renamed Columns","GB","GREG BROWN",Replacer.ReplaceText,{"Taken By"})

 

= Table.ReplaceValue(#"Replaced Value","CD","CHARLIE DAVIS",Replacer.ReplaceText,{"Taken By"})

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

How about creating a custom column using if else function?

if [initials] = "GB" then "GREG BROWN" else if [initials] = "CD" then "CHARLIE DAVIS" else ""

6.PNG

 

Best Regards,

Jay

View solution in original post

6 REPLIES 6
vivekhn
Advocate I
Advocate I

Hello,

You can use the if else statements to replace multiple categories in a single power query replace value formula.
For example, If you have a status column with the values A,I,T and wish to replace them with Active, Inactive, and Terminated use the formula provided below.

= Table.ReplaceValue(
#"Filtered Rows", 
each [Status],
each if [Status] = "A" then "Active" else if [Status] = "I" then "Inactive" else "Terminated",
Replacer.ReplaceValue,{"Status"}
)

Anonymous
Not applicable

Hi @Anonymous ,

 

How about creating a custom column using if else function?

if [initials] = "GB" then "GREG BROWN" else if [initials] = "CD" then "CHARLIE DAVIS" else ""

6.PNG

 

Best Regards,

Jay

Ashish_Mathur
Super User
Super User

Hi,

Create a seperate 2 column table with Initials in the first column and Name in the second column.  Then use the Merge tables functionality to bring over Name from this new table into your existing one.  From your existing table, you may then remove the Initials column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur   This implies setting up a standalone table.  

 

I am changing the initials, which are part of our ERP system's input.    User's select the "Taken By"  column and choose from a drop down to select their initials.  

 

By changing the values in this column from initials, to full name, I can make sure the original column from the data source is updated.  I don't really want to use a standalone table.  

@Anonymous - Wait, what do you mean updating the original data source? Using @Ashish_Mathur method you can remove and rename columns and such to make things like the original Source data.

 

Maybe I'm not clear on what you are trying to achieve exactly but @Ashish_Mathur said exactly what I would have said.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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