Search code examples
listpowerbiconcatenationpowerquerym

Concatenating Strings in Power Query (M) by Delimiters Position


I currently have two columns of strings like the following. And want to concatenate the two columns together to make the third using Power Query. I have been trying to find a way for several days with no luck. If a way could be found using DAX I would accept that solution as well.

Example of Columns and Desired Output

I have tried several different "list.*" type functions, and tried to use different text functions with no avail.


Solution

  • In powerquery, Add column ... custom column ... with

    = Text.Combine(let a=Text.Split([Measurements Taken],","), b=Text.Split([#"# of Measurment"],",") in List.Transform(List.Positions (a), each a{_}&"-"&b{_}),",")
    

    or

    = Text.Combine(List.Transform(List.Zip({Text.Split([Measurements Taken],","),Text.Split([#"# of Measurment"],",")}), each _{0}&"-"&_{1}),",")
    

    enter image description here