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

Join 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.

Reply
Anonymous
Not applicable

Replace values/Data Transformation Power Query Performance

Hi Power BI Community,

I needed to do a lot of changes in my Power Query. This is not good for the perfomance. 

Why does Power Query dont summarize these steps.

Beginner_2020_0-1612774947165.png


Data looks like this: 
= Table.ReplaceValue(#"Replaced Value57","AIMS 45-193i","AIMS",Replacer.ReplaceText,{"Tool Cluster"})
= Table.ReplaceValue(#"Replaced Value56","MeRiT MG 45","MeRiT",Replacer.ReplaceText,{"Tool Cluster"})

How can I combine this steps and also speed up the overall performance?

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can refer these documents to create a replacetable and a custom function to replace multiple fields at once:

  1. Multiple replacements or translations in Power BI and Power Query 
  2. Multiple Replacements of words in Power Query 
  3. Replace multiple values in a single step 
let 
    ReplaceAll = (InputTable as table, ColumnName as text,ReplacementTable as table, optional StartRow as number) =>
    let
    ActualRow = if StartRow = null then 0 else StartRow,
    result = Table.ReplaceValue(InputTable,ReplacementTable{ActualRow}[Old],ReplacementTable{ActualRow}[New],Replacer.ReplaceText,{ColumnName}),
    NextRow = ActualRow + 1,
    OutputTable = if NextRow > (Table.RowCount(ReplacementTable)-1) then result 
    else
    @ReplaceAll(result,ColumnName,ReplacementTable,NextRow)
    in
    OutputTable
    in 
    ReplaceAll

Attached a sample file in the below, hopes it could help.

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can refer these documents to create a replacetable and a custom function to replace multiple fields at once:

  1. Multiple replacements or translations in Power BI and Power Query 
  2. Multiple Replacements of words in Power Query 
  3. Replace multiple values in a single step 
let 
    ReplaceAll = (InputTable as table, ColumnName as text,ReplacementTable as table, optional StartRow as number) =>
    let
    ActualRow = if StartRow = null then 0 else StartRow,
    result = Table.ReplaceValue(InputTable,ReplacementTable{ActualRow}[Old],ReplacementTable{ActualRow}[New],Replacer.ReplaceText,{ColumnName}),
    NextRow = ActualRow + 1,
    OutputTable = if NextRow > (Table.RowCount(ReplacementTable)-1) then result 
    else
    @ReplaceAll(result,ColumnName,ReplacementTable,NextRow)
    in
    OutputTable
    in 
    ReplaceAll

Attached a sample file in the below, hopes it could help.

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , see if this blog on bulk replace can help

https://www.howtoexcel.org/power-query/bulk-replace-values/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.