Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DataXcelGPT
New Member

Power Query, Sort date MMM-YYYY field in Excel Power Query Editor

I have a table in Power Query which has a text field with dates in the format "MMM-YYYY". The issue I'm having is that when I create a pivot table, it sorts this field in Alphabetical order with "Apr-2023" on top. I need a way to sort it correctly with "Jan-2023" on top. 

3 REPLIES 3
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you'll probably need to create a sort order column and then use sort by column on the column tools ribbon on you current field. The easiest way to do it would be to add a new date field, spliting out the month and year and adding the day 01 to the begining.

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

or use Date.FromText([Date Field]) in custom column in power query to create the column

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Anonymous
Not applicable

The same issue occured for me;

I think if you convert to date as DOLEARY85 says, then sort then pivot iot should work. Mine was to summarise hours for week ending.

Advanced editor steps here;

#"Sorted Rows2" = Table.Sort(#"Replaced Value",{{"Week Ending Sunday", Order.Ascending}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Sorted Rows2", {{"Week Ending Sunday", type text}}, "en-AU"), List.Distinct(Table.TransformColumnTypes(#"Sorted Rows2", {{"Week Ending Sunday", type text}}, "en-AU")[#"Week Ending Sunday"]), "Week Ending Sunday", "Hours", List.Sum)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors