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
Divya904
Helper III
Helper III

DAX Calendar - Date Sorting

Hi All

 

I have created a DAX calculation to generate the calendar Date as given below. After executing this code, i have got a table named 'Date' which has columns: Calendar Date, day, month, year.

I need to sort Calendar day in descending order in my slicer like most recent dates on top. Please let me know how can i do that. Thanks.

 

 

 

Date =
GENERATE (
CALENDARAUTO(),
VAR currentDay = [Date]
VAR day = DAY( currentDay )
VAR month = MONTH ( currentDay )
VAR year = YEAR ( currentDay )
RETURN ROW (
"day", day,
"month", month,
"year", year )
)

1 ACCEPTED SOLUTION

Hi @Divya904

 

It is possible to create a default sort order, but you need to generate a separate column that has negative values for each month and then use the "Sort by Column" feature to set the default order.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

6 REPLIES 6
prateekraina
Memorable Member
Memorable Member

Hi @Divya904,

 

Click on the elipses on the top right corner of the slicer and change sort order to descending.
Capture.PNG

 

Prateek Raina

Hi, I need to create a custom sort in chart for example, it should start from,Oct as 1,Nov as 2,Dec as 3,Jan as 4 soon on...can you please help me on this

Hi Prateek,
Thanks for replying on it.
Can we sort the field instead. So that in all the reports it comes as sorted by default.
Thanks

Hi @Divya904,

 

By default, every field is sorted in ascending order.

As of now, there is no way apart from the earlier approach I told, to modify the sort order in visuals.

 

Once you have changed the sort orders to descedning and then published the report, your users will see it in descending order only so they will not have to again sort as you have done it during report creation.

 

Prateek Raina

Hi @Divya904

 

It is possible to create a default sort order, but you need to generate a separate column that has negative values for each month and then use the "Sort by Column" feature to set the default order.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @

 

On the slicer visual, click the three dots in the top right-hand corner, then chose the appropriate sort required.  Be wary that you may need to click the name of the field to sort and then repeat to click the little A/Z icon to the left of the field name to control the sort direction

 

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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