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
mariomaraucci
New Member

Power Query - Replace values based on another table's data

Hi, I am new to the Power Query world and this community 🙂

 

I'm struggling with a task -  I have a table "All_Skills" that contains 2 columns like this:

SkillCenter
LicensingOther
Billing Inquiries

Billing

Windows supportComputer Software
Linux supportComputer Software
Payment deniedBilling
Laptop replacementComputer Hardware

 

Then, I have another query that generates a new table, and the "Interaction" column can contains the same values listed in "All_Skill[Skill]".

 

What I want to do is to replace all the values in a duplicate of "Interaction" based on the matched value in All_Skills[Center]", like:

InteractionInteraction_Center
Licensing > Billing Inquiries > Payment deniedOther > Billing > Billing
Billing Inquiries > Laptop replacementBilling > Computer Hardware
Linux support > Laptop replacementComputer Software > Computer Hardware

 

I tried using this, but doens't seem to be working, although I'm not getting any erorr:

= Table.ReplaceValue(#"Duplicated Column",each All_Skills[Skille],each All_Skills[Center],Replacer.ReplaceText,{"Interactions_Center"})

 

I know I could split the Interaction column by delimiter, then merge every output column with the existing table and get the Center, then merge again the columns, but it can also get 20-30 output columns and I'd like to avoid all these merges.

 

Any ideas? I hope there will be a solution to this, and I definitely need to study more 😅

 

Thanks!

 

2 ACCEPTED SOLUTIONS
jennratten
Super User
Super User

Hello - this makes perfect sense.  Please have a look at the attached example, which demonstrates how to use a mapping table to perform multiple replaces in other tables.

View solution in original post

Vijay_A_Verma
Super User
Super User

Use a custom column and put following formula there

= Text.Combine(List.Transform(Text.Split([Interaction],">"),(x)=>try All_Skills{[Skill=Text.Trim(x)]}[Center] otherwise null)," > ")

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8slMTs0rzsxLV4gpNTAwTj20wCkzJwfE98wrLM0sykwthssEJFbmpuaVKKSk5mWmpijF6kQr4Vbsk1hQkl+gUJRakJOYnArSB9bgk5lXWqFQXFpQkF9UgldxLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Interaction = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Interactions_Center", each Text.Combine(List.Transform(Text.Split([Interaction],">"),(x)=>try All_Skills{[Skill=Text.Trim(x)]}[Center] otherwise null)," > "))
in
    #"Added Custom"

View solution in original post

4 REPLIES 4
Vijay_A_Verma
Super User
Super User

Use a custom column and put following formula there

= Text.Combine(List.Transform(Text.Split([Interaction],">"),(x)=>try All_Skills{[Skill=Text.Trim(x)]}[Center] otherwise null)," > ")

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8slMTs0rzsxLV4gpNTAwTj20wCkzJwfE98wrLM0sykwthssEJFbmpuaVKKSk5mWmpijF6kQr4Vbsk1hQkl+gUJRakJOYnArSB9bgk5lXWqFQXFpQkF9UgldxLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Interaction = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Interactions_Center", each Text.Combine(List.Transform(Text.Split([Interaction],">"),(x)=>try All_Skills{[Skill=Text.Trim(x)]}[Center] otherwise null)," > "))
in
    #"Added Custom"

This is exactly what I needed! I'm still trying to understand WHY it works (😂), but once I'm free I'll dive into it to understand it fully!

Thanks so much, this helped me a lot!

jennratten
Super User
Super User

Hello - this makes perfect sense.  Please have a look at the attached example, which demonstrates how to use a mapping table to perform multiple replaces in other tables.

This is brilliant! It also just initiated myself to Power BI, so far I was only working in Power Query 😃

 

Thank you very much!

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.