I’m trying to order months in the right order in a table and in a graph. From what I understand, I have to order by month number in my “Date” Table, but it doesn’t work. What I am doing wrong?
I created my table using the following DAX code I found online :
Date = ADDCOLUMNS ( CALENDAR (DATE(2000;1;1); DATE(2025;12;31)); "DateAsInteger"; FORMAT ( [Date]; "YYYYMMDD" ); "Year"; YEAR ( [Date] ); "Monthnumber"; FORMAT ( [Date]; "MM" ); "YearMonthnumber"; FORMAT ( [Date]; "YYYY/MM" ); "YearMonthShort"; FORMAT ( [Date]; "YYYY/mmm" ); "MonthNameShort"; FORMAT ( [Date]; "mmm" ); "MonthNameLong"; FORMAT ( [Date]; "mmmm" ); "DayOfWeekNumber"; WEEKDAY ( [Date] ); "DayOfWeek"; FORMAT ( [Date]; "dddd" ); "DayOfWeekShort"; FORMAT ( [Date]; "ddd" ); "Quarter"; "Q" & FORMAT ( [Date]; "Q" ); "YearQuarter"; FORMAT ( [Date]; "YYYY" ) & "/Q" & FORMAT ( [Date]; "Q" ) )
And the table looks like this :
(My computer is in French, so the months names are displayed in French)
I did a sort on the monthnumber, but nothing change.
Here are the two problems I’m trying to solve:
First, I have a matrix displaying months as columns, but the order is not right
I get something like this :
It looks like the months appears in alphabetical order, even if the Time table is ordered by month number.
The second problem is about the same in a graph, but now the months are not displayed in alphabetical order. Here's a screenshot :
How can I solve this to get the months in the right order since ordering by monthnumber doesn't seem to work for me ? What I am doing wrong? My data table is linked to the Date table. My data table has date format as YYYY-MM-DD.
Solved! Go to Solution.
Are you, by chance, trying to solve this by sorting the month number column, itself? If so, that will not work. You need to select the Month Name column, and then choose the "Sort by Column" option. From there, choose to sort by the month number column.
That will turn your chart from looking like this: