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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sorting DAX date table

I currently have a date table I use for my table matrix.  Im trying to show 2020 and 2021 data in the matrix, but want it sorted desending showing jan 4 2021 first and going down.  I cant seem to get it that way since I have 3 date columns in the matrix Year, Month and day.  No matter waht way I sort I cannot get it this way. I tired sorting by all of the 3, but doesnt work since the year is the top.  Only works when Im doing 1 month. 

 

Thanks

10 REPLIES 10
Anonymous
Not applicable

Sorry I have been OOO.  I was able to just use the main date and sort it that way instead of by month, day , year

HI @Anonymous,

I'm not so clear about your descriptions, can you please share some dummy data with the expected result (the way similar as the above blog link mention) to help us clarify your scenario and requirements?

BTW, if you are working with situations that similar as creating 'sorting order' on a calendar based on fiscal date, you can take a look at the following blog:

DAX 101: Sorting months in fiscal calendars 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

HI @Anonymous.,

Did these suggestions help with your requirement? If not, please provide more detailed information and some dummy data to help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly 

Regards.

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Have you tried to create a calculated table with custom sorting orders and link to your raw table fields?

Custom Sorting in Power BI 

BTW, for multiple column sorting, you can try to use ISONORAFTER function:

Sorting by multiple columns 
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Where are you showing date , If you showing on column(pivot) you need to have sort column to change it to descending.

 

Create date if you do not have

Date = date([Year],[month], [day])

Date1 = date([Year],[month], [day])

Date Sort = rankx(all(Table), [Date],,desc)

 

Sort Date1 on date sort and use.

Refer to my video on this: https://www.youtube.com/watch?v=KK1zu4MBb-c

sort.png

ASK15
Frequent Visitor

i have sorted year month column from month no

ASK15
Frequent Visitor

i have been facing same problem .year sorting with follow the month sequnce

Anonymous
Not applicable

Its in a MAtrix table

vanessafvg
Super User
Super User

 why dont you create a date column from the 3 columns?  





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.