Forum Discussion

jaryszek's avatar
jaryszek
Super User
4 years ago
Solved

Merge values from rows into one row

Hi Guys,   i have table like here: 1 DeploymentsMap 6 DeploymentsMap 3 DeploymentsMap 6 DeploymentsMap   and what i want to get is: TableName|Index DeploymentsMap 1;3;6 ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi jaryszek ,

     

    Please try:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJJLcjJr8xNzSsp9k0sUIrViVYywy5sjF3Y0NrI2tjaxNoUu7QRUNjRyRnMNoGxYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
        #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Column1", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
        #"Removed Duplicates" = Table.Distinct(#"Split Column by Delimiter"),
        #"Grouped Rows" = Table.Group( #"Removed Duplicates", {"Column2"}, {{"Combined", each Text.Combine(List.Sort(List.Distinct([Column1])), ";")}})
    in
        #"Grouped Rows"

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.