Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register 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
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |