Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
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?
Solved! Go to Solution.
Hi @Anonymous ,
You can refer these documents to create a replacetable and a custom function to replace multiple fields at once:
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.
Hi @Anonymous ,
You can refer these documents to create a replacetable and a custom function to replace multiple fields at once:
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.
@Anonymous , see if this blog on bulk replace can help
https://www.howtoexcel.org/power-query/bulk-replace-values/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |