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

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

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors