Source |
|
|
|
Result |
|
# |
Owner |
Make |
|
Owner |
Car |
1 |
Jeremy |
Ford |
|
Jeremy |
Ford |
2 |
Jill |
Toyota |
|
Jill |
Toyota |
3 |
Jack |
Toyota |
|
Jack |
Toyota |
4 |
Arnold |
Ford |
|
Arnold |
Ford,Holden,Mazda,Mercedes |
5 |
Arnold |
Holden |
|
Sage |
Toyota |
6 |
Arnold |
Mazda |
|
Patrick |
Toyota,Tesla |
7 |
Arnold |
Mercedes |
|
Alex |
Unknown |
8 |
Sage |
Toyota |
|
Rain |
Tesla |
9 |
Patrick |
Toyota |
|
|
|
10 |
Patrick |
Tesla |
|
|
|
11 |
Alex |
Unknown |
|
|
|
12 |
Rain |
Tesla |
|
|
|
Output must retain hierarchy that input has i.e. Jeremy must remain on top, Jill must remain the next, etc.
Code:
// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Grp = Table.Group(Source, {"Owner"}, {{"All", each _, type table [#"#"=number, Owner=text, Make=text]}}),
List = Table.AddColumn(Grp, "Car", each [All][Make]),
Ext = Table.TransformColumns(List, {"Car", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
Ext
Bookmarks