Search code examples
powerquery

Group and concatenate columns in power query


I want to get this result in power query from the first to the second which concatenates and group columns at the same time.

Thank you for your help.

enter image description here


Solution

  • Try

    let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Item", "Description"}, {
        {"Qty", each List.Sum([Qty]), type number},
        {"lots", each Text.Combine(Table.AddColumn(_, "Custom", each Text.From([Lot])&"("&Text.From([Qty])&")")[Custom],","), type text}
    })
    in  #"Grouped Rows"
    

    enter image description here