Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
https://community.powerbi.com/t5/Desktop/Replacing-multiple-values-in-multiple-columns/td-p/313013
Almost exactly like the above link, except I'm trying to only use 1 replacement table. I know I need to remove a loop here somewhere, but not sure where!
#"CPE-Char-Subs-tbl-rev" is my translation table.
#"CPE-22-parsed" is the table that I need to transform. Only need to transform the columns in the variable ColumnsToTransform.
let
ColumnsToTransform = {"Vendor", "Product", "Version", "Update", "Edition"},
TranslationLists = List.Buffer(Table.ToRows(#"CPE-Char-Subs-tbl-rev")),
TransformSpecs = List.Buffer(List.Zip({ColumnsToTransform,TranslationLists})),
Source = #"CPE-22-parsed",
Replaced =
List.Accumulate(
TransformSpecs,
Source,
(t1,r1) =>
List.Accumulate(
r1{1},
t1,
(t2,r2) =>
Table.TransformColumns(
t2,
{r1{0},
each Replacer.ReplaceText(_,r2{0},r2{1})}
)
)
),
Result = Value.ReplaceType(Replaced,Value.Type(Source))
in
ResultThank you in advance for any pointers!
Solved! Go to Solution.
Untested but, maybe in the right direction...
let
ColumnsToTransform = {"Vendor", "Product", "Version", "Update", "Edition"},
TranslationList = List.Buffer(Table.ToRows(#"CPE-Char-Subs-tbl-rev")),
Source = #"CPE-22-parsed",
Replaced =
List.Accumulate(
ColumnsToTransform,
Source,
(sourceOuter,col) =>
List.Accumulate(
TranslationList,
sourceOuter,
(sourceInner,translationCouple) =>
Table.TransformColumns(
sourceInner,
{col,
each Replacer.ReplaceText(_,translationCouple{0},translationCouple{1})}
)
)
),
Result = Value.ReplaceType(Replaced,Value.Type(Source))
in
Result
Untested but, maybe in the right direction...
let
ColumnsToTransform = {"Vendor", "Product", "Version", "Update", "Edition"},
TranslationList = List.Buffer(Table.ToRows(#"CPE-Char-Subs-tbl-rev")),
Source = #"CPE-22-parsed",
Replaced =
List.Accumulate(
ColumnsToTransform,
Source,
(sourceOuter,col) =>
List.Accumulate(
TranslationList,
sourceOuter,
(sourceInner,translationCouple) =>
Table.TransformColumns(
sourceInner,
{col,
each Replacer.ReplaceText(_,translationCouple{0},translationCouple{1})}
)
)
),
Result = Value.ReplaceType(Replaced,Value.Type(Source))
in
Result
That was it exactly Robert. Thank you! I only copied and pasted your code, will dive into it in a few minutes to understand 🙂
@ImkeFor @MarcelBeug are probably 2 of the best people to help.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |