Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a simple two column table
invoice and Product
there are mutliple products per invoice so there is a record per invocie and product combination
I want to end up with one record per invoice and a column that has the products in a csv string.
how do I do this?
Invoice | Product |
1 | a |
1 | b |
1 | c |
End u pwith
Inovice
Invoice | Product |
1 | a,b,c |
Solved! Go to Solution.
Consider the table...
You can get the result...
With the code...
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWBsJLgrGQwywguawQXMwayUpRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Invoice = _t, Product = _t]),
#"Grouped Rows" = Table.Group(Source, {"Invoice"}, {{"Product", each _, type table [Invoice=nullable text, Product=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([Product], "Product")),
#"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values",{"Product"})
in
#"Removed Columns"
Proud to be a Super User! | |
Consider the table...
You can get the result...
With the code...
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWBsJLgrGQwywguawQXMwayUpRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Invoice = _t, Product = _t]),
#"Grouped Rows" = Table.Group(Source, {"Invoice"}, {{"Product", each _, type table [Invoice=nullable text, Product=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([Product], "Product")),
#"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values",{"Product"})
in
#"Removed Columns"
Proud to be a Super User! | |