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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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.

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

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.

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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