Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
HI Experts,
I have 4 different calculated Date columns based on criteria, Which I am using for 4 different Column Visuals.
I want to sort Date Columns in to MM-YYYY Order in Column Visual (Horizontal)
I can add 4 more columns for each date column and then I can give groupings and sort the order.
But with out adding 4 more columns, can I sort the my Horizontal Column Visual in Order? (Yellow is Blank which has no dates)
I converted Date Column Data Type to MM-YYYY and also tried to Formatted to "MM-YYYY" but it is not sorting order.
Thanks in Advance
Solved! Go to Solution.
Hi @Sudhavi_84 ,
Yes, the code I gave was for a new column in Power Query, as DAX calculated columns are not generally recommended.
If you really need to do it in DAX, then the column formula would be:
..yearMonthSortKey = YEAR(yourTable[Date]) * 100 + MONTH(yourTable[Date])
Pete
Proud to be a Datanaut!
Hi @Sudhavi_84 ,
Create a [yearMonth] field in your calendar.
In Power Query your column calc would be something like this:
Date.Year([Date]) * 100 + Date.Month([Date])
Once you have this column, you can use it as a Sort By column for your MM-YYYY column.
Pete
Proud to be a Datanaut!
Thank you @BA_Pete for your quick response.
I have MMMYYYY column in calendar. Which is perfect as below in calendar table.
Next I am going to table-->Adding Column-->Date.Year is greying out not showing me anything. Please let me know if I am missing something here.
Please any help?
Is this something we need to write in Power Query (M Editor)? Not in new calculated column?
Hi @Sudhavi_84 ,
Yes, the code I gave was for a new column in Power Query, as DAX calculated columns are not generally recommended.
If you really need to do it in DAX, then the column formula would be:
..yearMonthSortKey = YEAR(yourTable[Date]) * 100 + MONTH(yourTable[Date])
Pete
Proud to be a Datanaut!
Perfect Thank You
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 71 | |
| 50 | |
| 46 | |
| 44 |