Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Power BI community,
I am currently facing an issue while trying to create a pivot table in Power Query with unpivoted data. Specifically, I have three columns: EmployeeName, Year, and Count, in unpivoted order. My goal is to pivot this data while preserving the original sort order of the EmployeeName column and arranging the years in ascending order.
However, when I pivot the data by selecting the Year column, the EmployeeName order changes. I would greatly appreciate your assistance in achieving this objective while maintaining the initial sort order of the EmployeeName column and ensuring that the years are displayed in ascending order.
Your expertise and guidance on this matter would be invaluable to me. Thank you in advance for your time and assistance.
Best regards,
Qasim
Solved! Go to Solution.
Hi @Qasim_Jan ,
Before you perform your pivot step in Power Query, go to the Add Column tab > Index Column > From 1. This will index your table in the current sort order.
After you pivot , you can then sort by the index column and year to get the data in the exact order you want.
Pete
Proud to be a Datanaut!
Hi @Qasim_Jan ,
Before you perform your pivot step in Power Query, go to the Add Column tab > Index Column > From 1. This will index your table in the current sort order.
After you pivot , you can then sort by the index column and year to get the data in the exact order you want.
Pete
Proud to be a Datanaut!
Hi @BA_Pete ,
Your suggestion to add an index column before the pivot and then sorting by the index column and year was spot on. It worked like a charm!
Your expertise and willingness to assist are truly appreciated. Thank you once again for your prompt and effective help.
Best regards,
Qasim
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 7 | |
| 4 | |
| 3 |