Forum Discussion
MM-DDDD Sorting Order in Column Visual
- 5 years ago
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
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
- Sudhavi_845 years agoHelper V
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.
MMYYYY = Date.Year (I am getting below error)Please any help?
- Sudhavi_845 years agoHelper V
Is this something we need to write in Power Query (M Editor)? Not in new calculated column?
- BA_Pete5 years agoSuper User
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