Forum Discussion
Transpose groups of rows into Columns
Hello!
Could you please assist how can i group transpose rows into columns:
Input:
Output:
The original numbers of rows is quite big but they are repetetive.
| Column 1 | Column 2 |
| Product_id | 1234 |
| Date | 01-2014-20 |
| Unit | 1 |
| Revenue | 4321 |
| Product_id | 2345 |
| Date | 01-2014-21 |
| Unit | 2 |
| Revenue | 4321 |
| Product_id | 3211 |
| Date | 01-2014-22 |
| Unit | 3 |
| Revenue | 12345 |
Thanks!
- Anonymous5 years ago
try this
Hi Anonymous ,
Check my similar thread below:
Solved: Turn 2 columns into multiple columns based on a no... - Microsoft Power BI Community
It has detailed steps inside.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- Anonymous5 years ago
For this scenario, I would split the table into page sizes of 4 rows, and then Transpose and Promote the Headers in the list of tables. Then you can just expand them!
let
Source = Excel.CurrentWorkbook(){[Name="Products"]}[Content],
Custom1 = List.Transform(Table.Split(Source, 4), each Table.Transpose(_)),
Custom2 = List.Transform(Custom1, each Table.PromoteHeaders(_)),
#"Converted to Table" = Table.FromList(Custom2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"Product_id", "Date", "Unit", "Revenue"}, {"Product_id", "Date", "Unit", "Revenue"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"Product_id", type text}, {"Date", type text}, {"Unit", type text}, {"Revenue", type text}})
in
#"Changed Type"--Nate
3 Replies
- AnonymousNot applicable
- v-kelly-msftCommunity Support
Hi Anonymous ,
Check my similar thread below:
Solved: Turn 2 columns into multiple columns based on a no... - Microsoft Power BI Community
It has detailed steps inside.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- AnonymousNot applicable
For this scenario, I would split the table into page sizes of 4 rows, and then Transpose and Promote the Headers in the list of tables. Then you can just expand them!
let
Source = Excel.CurrentWorkbook(){[Name="Products"]}[Content],
Custom1 = List.Transform(Table.Split(Source, 4), each Table.Transpose(_)),
Custom2 = List.Transform(Custom1, each Table.PromoteHeaders(_)),
#"Converted to Table" = Table.FromList(Custom2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"Product_id", "Date", "Unit", "Revenue"}, {"Product_id", "Date", "Unit", "Revenue"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"Product_id", type text}, {"Date", type text}, {"Unit", type text}, {"Revenue", type text}})
in
#"Changed Type"--Nate