The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I am constantly have to transpose several combined data from rows to columns, would anyone share with me a way to automate this step? I include the original file, and the file I have done manually transpose. Any insights given would be really appreciated. Thank you!
This is the original file. All number are fiction.
Catawba | BROOKFORD | Long View | Maiden | |
12:00 AM | 59622 | 24882 | 308717 | 332106 |
1:00 AM | 52168 | 23444 | 300474 | 318413 |
2:00 AM | 49810 | 22999 | 284503 | 311975 |
3:00 AM | 48836 | 22810 | 275210 | 311887 |
4:00 AM | 50843 | 22506 | 274961 | 309800 |
5:00 AM | 53966 | 22446 | 284749 | 335413 |
6:00 AM | 66314 | 22996 | 315933 | 416965 |
7:00 AM | 91823 | 28273 | 371370 | 555093 |
8:00 AM | 109845 | 31579 | 416492 | 617615 |
9:00 AM | 128690 | 36008 | 479083 | 714802 |
10:00 AM | 146754 | 44975 | 550097 | 765870 |
11:00 AM | 155182 | 45830 | 605371 | 802899 |
12:00 PM | 156449 | 42320 | 636233 | 794496 |
1:00 PM | 156952 | 39533 | 595909 | 730753 |
2:00 PM | 161782 | 40682 | 583663 | 735026 |
3:00 PM | 157276 | 41274 | 592827 | 655151 |
4:00 PM | 141062 | 42670 | 589399 | 663802 |
5:00 PM | 147334 | 43483 | 592857 | 744612 |
6:00 PM | 163352 | 44215 | 605375 | 802784 |
7:00 PM | 163665 | 43416 | 571766 | 734993 |
8:00 PM | 146098 | 41127 | 498608 | 578622 |
9:00 PM | 117490 | 37188 | 407164 | 454785 |
10:00 PM | 91888 | 33271 | 350620 | 368028 |
11:00 PM | 73268 | 27624 | 320509 | 331855 |
This is what I wanted:
Catawba | 12:00 AM | 59622 |
Catawba | 1:00 AM | 52168 |
Catawba | 2:00 AM | 49810 |
Catawba | 3:00 AM | 48836 |
Catawba | 4:00 AM | 50843 |
Catawba | 5:00 AM | 53966 |
Catawba | 6:00 AM | 66314 |
Catawba | 7:00 AM | 91823 |
Catawba | 8:00 AM | 109845 |
Catawba | 9:00 AM | 128690 |
Catawba | 10:00 AM | 146754 |
Catawba | 11:00 AM | 155182 |
Catawba | 12:00 PM | 156449 |
Catawba | 1:00 PM | 156952 |
Catawba | 2:00 PM | 161782 |
Catawba | 3:00 PM | 157276 |
Catawba | 4:00 PM | 141062 |
Catawba | 5:00 PM | 147334 |
Catawba | 6:00 PM | 163352 |
Catawba | 7:00 PM | 163665 |
Catawba | 8:00 PM | 146098 |
Catawba | 9:00 PM | 117490 |
Catawba | 10:00 PM | 91888 |
Catawba | 11:00 PM | 73268 |
BROOKFORD | 12:00 AM | 24882 |
BROOKFORD | 1:00 AM | 23444 |
BROOKFORD | 2:00 AM | 22999 |
BROOKFORD | 3:00 AM | 22810 |
BROOKFORD | 4:00 AM | 22506 |
BROOKFORD | 5:00 AM | 22446 |
BROOKFORD | 6:00 AM | 22996 |
BROOKFORD | 7:00 AM | 28273 |
BROOKFORD | 8:00 AM | 31579 |
BROOKFORD | 9:00 AM | 36008 |
BROOKFORD | 10:00 AM | 44975 |
BROOKFORD | 11:00 AM | 45830 |
BROOKFORD | 12:00 PM | 42320 |
BROOKFORD | 1:00 PM | 39533 |
BROOKFORD | 2:00 PM | 40682 |
BROOKFORD | 3:00 PM | 41274 |
BROOKFORD | 4:00 PM | 42670 |
BROOKFORD | 5:00 PM | 43483 |
BROOKFORD | 6:00 PM | 44215 |
BROOKFORD | 7:00 PM | 43416 |
BROOKFORD | 8:00 PM | 41127 |
BROOKFORD | 9:00 PM | 37188 |
BROOKFORD | 10:00 PM | 33271 |
BROOKFORD | 11:00 PM | 27624 |
Long View | 12:00 AM | 308717 |
Long View | 1:00 AM | 300474 |
Long View | 2:00 AM | 284503 |
Long View | 3:00 AM | 275210 |
Long View | 4:00 AM | 274961 |
Long View | 5:00 AM | 284749 |
Long View | 6:00 AM | 315933 |
Long View | 7:00 AM | 371370 |
Long View | 8:00 AM | 416492 |
Long View | 9:00 AM | 479083 |
Long View | 10:00 AM | 550097 |
Long View | 11:00 AM | 605371 |
Long View | 12:00 PM | 636233 |
Long View | 1:00 PM | 595909 |
Long View | 2:00 PM | 583663 |
Long View | 3:00 PM | 592827 |
Long View | 4:00 PM | 589399 |
Long View | 5:00 PM | 592857 |
Long View | 6:00 PM | 605375 |
Long View | 7:00 PM | 571766 |
Long View | 8:00 PM | 498608 |
Long View | 9:00 PM | 407164 |
Long View | 10:00 PM | 350620 |
Long View | 11:00 PM | 320509 |
Maiden | 12:00 AM | 332106 |
Maiden | 1:00 AM | 318413 |
Maiden | 2:00 AM | 311975 |
Maiden | 3:00 AM | 311887 |
Maiden | 4:00 AM | 309800 |
Maiden | 5:00 AM | 335413 |
Maiden | 6:00 AM | 416965 |
Maiden | 7:00 AM | 555093 |
Maiden | 8:00 AM | 617615 |
Maiden | 9:00 AM | 714802 |
Maiden | 10:00 AM | 765870 |
Maiden | 11:00 AM | 802899 |
Maiden | 12:00 PM | 794496 |
Maiden | 1:00 PM | 730753 |
Maiden | 2:00 PM | 735026 |
Maiden | 3:00 PM | 655151 |
Maiden | 4:00 PM | 663802 |
Maiden | 5:00 PM | 744612 |
Maiden | 6:00 PM | 802784 |
Maiden | 7:00 PM | 734993 |
Maiden | 8:00 PM | 578622 |
Maiden | 9:00 PM | 454785 |
Maiden | 10:00 PM | 368028 |
Maiden | 11:00 PM | 331855 |
Solved! Go to Solution.
Hi @ale259 ,
Thank you for your inputs @Cookistador @FreemanZ @Deku .
The Unpivot Columns feature in Power Query is indeed the most suitable approach for this transformation.
1️. Select the first column (Time) and unpivot the remaining columns using Transform → Unpivot Columns in Power Query.
2️. This will restructure the table into a City | Time | Value format.
3️. If necessary, rename the columns for clarity and sort by city name for better organization.
FYI:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ale259 ,
Has your issue been resolved, or do you require any further information? Your feedback is valuable to us. If the solution was effective, please mark it as 'Accepted Solution' to assist other community members experiencing the same issue.
Hi @ale259 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You.
Thank you all!
If your issue is resolved, please consider marking it as the Accepted solution. This helps other community members who may face a similar issue find the solution more easily.
Regards,
Yugandhar.
Hi @ale259 ,
Thank you for your inputs @Cookistador @FreemanZ @Deku .
The Unpivot Columns feature in Power Query is indeed the most suitable approach for this transformation.
1️. Select the first column (Time) and unpivot the remaining columns using Transform → Unpivot Columns in Power Query.
2️. This will restructure the table into a City | Time | Value format.
3️. If necessary, rename the columns for clarity and sort by city name for better organization.
FYI:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @ale259 ,
this is standard unpivot.
Right click the header of first column and choose "Unpivot Other Columns"
then you shall get what you want.
let
Source = yourSource,
unpivot = Table.UnpivotOtherColumns(Source , {"Time"}, "Attribute", "Value")
in
unpivot
To do that,
Go in Power Query and select the 4 columns
Then, go in Transform --> Unpivot columns and select Unpivot Columns
And tadam:
You can sort by name if you need 🙂