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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.