Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Another sort by date problem

Hi.

 

Im going crazy trying to just get the date table to be sorted correctly

 

I used this dax:

 

Calendar =
var _calendar = CALENDAR("1/1/2020", "12,31,2023")
return
ADDCOLUMNS(_calendar, "Year", YEAR([Date]), "Month Number", MONTH([Date]),"Month", FORMAT([Date], "mmmm"), "Quarter", "QTR "&FORMAT([Date], "Q"), "Quarter Number", FORMAT([Date],"Q"))
 
But it just wont sort correctly, I sort by column "Month Number" but it keeps starting with the number 7 instead of 1
 
Any ideas?
 
1 ACCEPTED SOLUTION

Follow these steps:

MURTAZA_1-1618870900642.png

 

View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

Your DAX table expression worked fine for me, including the Sort By column.  Please see this article/video on how to create Date tables that don't need to be sorted.  There is one you can copy/paste and use directly.

No Sort Date Tables! – Hoosier BI

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


MURTAZA
Resolver I
Resolver I

@Anonymous 

A quick way to resolve this is to use Power BI generated Date Hierarchy, instead of using newly created columns.

MURTAZA_0-1618868237767.png

 

Anonymous
Not applicable

and how do I do that?

Follow these steps:

MURTAZA_1-1618870900642.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.