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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors