Reply
avatar user
Anonymous
Not applicable
Partially syndicated - Outbound

Sort Months in chronological order

So I have a date table which has the dax measure 

 

Rolling =
VAR FutureMonth = IF(MONTH(TODAY()) > 6 , MONTH(TODAY())-6 , MONTH(TODAY()) + 6)
VAR FutureYear = IF(MONTH(TODAY()) > 6 , YEAR(TODAY())+1 , YEAR(TODAY()) )

Return

IF('Date Table'[Date] < DATE(YEAR(TODAY()), MONTH(TODAY()), 1) , BLANK () ,
IF('Date Table'[Date]>= DATE(FutureYear, FutureMonth, 1) , "Rest of the Dates" , [month] )

)
 
However, everything works perfectly fine its just the order of montha is not in chronological order.
I have added a month sort column. I've also added a new table with Year month and Sort order however that doesnt seem to do the trick either.
any help on this?
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Syndicated - Outbound

Hi @Anonymous,

Perhaps you can try to extract the current category values to create a new table with custom sorting order and link to raw table fields.
After these steps, you can use the new table field to replace the old one then power bi will apply the custom sort orders on your visuals.

Custom Sorting in Power BI  
Regards,

Xiaoxin Sheng

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

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Syndicated - Outbound

Hi @Anonymous,

Perhaps you can try to extract the current category values to create a new table with custom sorting order and link to raw table fields.
After these steps, you can use the new table field to replace the old one then power bi will apply the custom sort orders on your visuals.

Custom Sorting in Power BI  
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

Syndicated - Outbound

@Anonymous , assume you have a column

Month Year = FORMAT([Date],"mmm-yyyy")

 

You have sort column
Month Year sort = FORMAT([Date],"yyyymm")

 

You need mark that sort column and sort on month year in visual

 

Sort Month Year.png

 

How to Create Sort Column and Solve Related Errors: https://youtu.be/KK1zu4MBb-c

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
avatar user
Anonymous
Not applicable

Syndicated - Outbound

I've added that but it doesnt apply to my visual. Am i supposed to add them to the visual, as i think its the rolling measure that its not working on?

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)