Forum Discussion

isg's avatar
isg
Frequent Visitor
8 months ago
Solved

Help with Implementing Reiteration for Conditional Replacement of Values through "Coupled" Columns

Hi everyone,   I have some data that I will need help from you Power Query experts to transform. The data looks like the below table (Data Input). Column Ax is matched with Column Bx, Ay with By, A...
  • AlienSx's avatar
    8 months ago
    let
        replacer = (text01, text02) => Text.Replace(text01 ?? "", text02 ?? "", ""),
        fxr = (lst) => (
            (data) => {lst{0}} & List.Transform(List.Zip(data), (x) => replacer(x{0}, x{1})) & data{1}
        )(List.Split(List.Skip(lst), (List.Count(lst) - 1) / 2)),
        Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
        ttl = Table.ToList(Source, fxr),
        result = #table(Value.Type(Source), ttl)
    in
        result