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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors