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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Dimani
Helper II
Helper II

Power BI Desktop - How to sort alpha months across 2 years?

Hi Power BI Desktop Community,

 

In Power BI Desktop, how to order months, when the months are spelled out and when the months are across 2 different years, for example, July 2023 to Jun 2024?

 

I tried using an index column with July being 1, August being 2 ... and sorting the index column, but that did not work.  I used column tools - sort by column.

 

I changed the index columns and/or the data columns to be text fields, but it did not work either. I ended up preceding the months with 01, 02, ....

 

Though it works, I wonder if there is a better way to do this?

 

Thanks

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Dimani 

Here are a couple of options.

I'll refer to your existing column as "Month Year Text".

 

1. To avoid having to set a Sort By Column:

  • Change "Month Year Text" to a column of type date (or add such a column)
  • Set its value to the first day of the month (for example)
  • Set is format string to "MMMM yyyy" or similar.

 

2. If you would like to keep the "Month Year Text" column and apply a Sort By Column:

  • Add a column "Start of Month" of type date containing the first of the month
  • Set "Month Year Text" to Sort By "Start of Month".

Examples attached.

Also see this article:

https://www.sqlbi.com/articles/creating-a-simpler-and-chart-friendly-date-table-in-power-bi/

OwenAuger_0-1726530345098.png

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

You describe a fiscal calendar.  While you could write DAX or Power Query code, this would be a waste of your time.  Calendars are immutable (their data never changes) so there is no need to compute them in Power BI. 

 

Prepare a reference table (for eaxmple an Excel file on a Sharepoint) that has all the required columns including the sort columns, fiscal year months etc. Then include that reference table in your data model.

OwenAuger
Super User
Super User

Hi @Dimani 

Here are a couple of options.

I'll refer to your existing column as "Month Year Text".

 

1. To avoid having to set a Sort By Column:

  • Change "Month Year Text" to a column of type date (or add such a column)
  • Set its value to the first day of the month (for example)
  • Set is format string to "MMMM yyyy" or similar.

 

2. If you would like to keep the "Month Year Text" column and apply a Sort By Column:

  • Add a column "Start of Month" of type date containing the first of the month
  • Set "Month Year Text" to Sort By "Start of Month".

Examples attached.

Also see this article:

https://www.sqlbi.com/articles/creating-a-simpler-and-chart-friendly-date-table-in-power-bi/

OwenAuger_0-1726530345098.png

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Hi OwenAuger and Ibendlin,

 

Thanks for both of your reply. After reading it, I went back to take a look at it again. I did not mention this in my original post; my data source is Excel.

 

Turns out using an index column works. I do not remember the exact sequence of events. But I did something like these in Power BI: changed the index column from text to whole number and selected don't summary.  Afterwards, sorting can be based on the index column, and that's the order we want.

 

Best regards.

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.