Forum Discussion

XhevahirMehalla's avatar
3 months ago
Solved

Unable to sort by Month using Date table which I created

Hello - 

 

I have a classical case when I am unable to show months in right Order even though I am trying the right thing and setup to accomodate that.

 

I have a date table which I created as:

Date =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2025, 12, 1 ), DATE ( 2026, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month_No", MONTH ( [Date] ),
    "Month", FORMAT ( [Date], "MMMM" ),
    "Month_Short", FORMAT ( [Date], "MMM" ),
    "Month_Key", YEAR ( [Date] ) * 100 + MONTH ( [Date] ),
    "Quarter", "Q" & QUARTER ( [Date] ),
    "Month_Start_Date", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 1 ),
    "Month_End_Date", EOMONTH ( [Date], 0 ),
    "Year_Quarter", FORMAT ( [Date], "YYYY" ) & " Q" & QUARTER ( [Date] )
)

 

I tried few things:

  1. Data tried to sort by Month_key - and it shows an error.
  2.  

     
  3. I tried to sort by in the visual - still not change.
  4.  

My visuals are not sorted correctly.

 

What I am missing? what else to do?

 

I need help!

 

Thanks

Xhev

  • You need to sort the month column by month number, not month key. December 2025 and December 2026 will have different month keys, but the same month number.

2 Replies

  • You need to sort the month column by month number, not month key. December 2025 and December 2026 will have different month keys, but the same month number.