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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
rkh
New Member

Sorting by Month as Text (Jan Feb Mar etc)

I used Format to get mmmyy from Date. But in reports, data is being sorted alpha. I want mmmyy sorted by month

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

You need to create a sort column and use that as sort column for month

 

Month sort = format(Date[Date],"MM")

Month Year sort = format(Date[Date],"YYYYMM")Sort_by_column.png

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @rkh 

 

You can also create two calculated columns as follows.

 

Month-Year = FORMAT('Table'[Date],"mmm-yy")
SortColumn = 
var _month = MONTH('Table'[Date])
var _year = YEAR('Table'[Date])
return
COUNTROWS(
        FILTER(
            ALL('Table'),
            MONTH('Table'[Date])>_month&&
            YEAR('Table'[Date])=_year
        )
)+1

 

 

Then you can make 'Month-Year' column selected, go to 'Modeling' ribbon, click 'Sort by Column', check 'SortColumn'.

d3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-alq-msft
Community Support
Community Support

Hi, @rkh 

 

Based on your description, I created data to reproduce your scenario. 

 

Table:

d1.png

Calendar :

Calender = CALENDARAUTO()
 
There is a one-to-one relationship between them.
 
You may use Year and Month columns from Calendar table to display the result.
d2.png
 

 

 

Best Regards

Allan

amitchandak
Super User
Super User

You need to create a sort column and use that as sort column for month

 

Month sort = format(Date[Date],"MM")

Month Year sort = format(Date[Date],"YYYYMM")Sort_by_column.png

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks Amit

TomMartens
Super User
Super User

Hey @rkh ,

 

basically, the default sorting of categorical columns like MonthName is alphabetical, if you want to change this behavior, it's necessary to create a column that contains the sortindex.

 

This is described in this article in general: https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column and especially: https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-butto...

 

Hopefully, this provides what you are looking for.

 

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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