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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I used Format to get mmmyy from Date. But in reports, data is being sorted alpha. I want mmmyy sorted by month
Solved! Go to Solution.
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")
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'.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @rkh
Based on your description, I created data to reproduce your scenario.
Table:
Calendar :
Best Regards
Allan
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")
Thanks Amit
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