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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
Most Valuable Professional
Most Valuable Professional

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
Most Valuable Professional
Most Valuable Professional

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.