Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I would like to use Power Query to transform the table below (Before) to the (After).
The idea would be to transpose rows (Sub Invoice#, Task Descriton, Price) to additional columns if the (InvoiceNumber) column matches.
Before
Before
After
Thank you!
Solved! Go to Solution.
=let col=Table.ColumnNames(Before) in Table.Combine(Table.Group(Before,"InvoiceNumber",{"n",each Table.FromRows({{[InvoiceNumber]{0}}&List.Combine(Table.ToRows(Table.SelectColumns(_,List.Skip(col))))},List.TransformMany({0..Table.RowCount(_)-1},each if _=0 then col else List.Skip(col),(x,y)=>if x=0 then y else y&" - "& Text.From(x+1)))})[n])
=let col=Table.ColumnNames(Before) in Table.Combine(Table.Group(Before,"InvoiceNumber",{"n",each Table.FromRows({{[InvoiceNumber]{0}}&List.Combine(Table.ToRows(Table.SelectColumns(_,List.Skip(col))))},List.TransformMany({0..Table.RowCount(_)-1},each if _=0 then col else List.Skip(col),(x,y)=>if x=0 then y else y&" - "& Text.From(x+1)))})[n])
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |