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
Brenden
Advocate II
Advocate II

Sorting Months

First time using a Date Table because I keep hearing I should. Unfortunately visuals are sorting Month names alphabetically. To try and get around that I have added the Month Number to my Date Table. Unfortunately even that is sorting alphabetically. How in the world can get the months to simply appear in the order in which they occur? 

 

Example of what is happening:

Apr, August, ...

Month #:

1, 10, 2, 3,...

 

Desired Result:
January, February..

 

Month#:
1, 2, 3...

 

Screenshots of the problems:

Brenden_1-1685033395573.png

 

 

Brenden_0-1685033367941.png

 

 

Here is the DAX I have used/modified trying to get the Date table to cooperate:

DateTable =

ADDCOLUMNS (

CALENDAR (DATE(2023,01,01), DATE(2023,12,31)),

"Year", YEAR ( [Date] ),

"Month", FORMAT ( [Date], "MMM" ),

"Month Number", FORMAT ( [Date], "M" ),

"Weeks",

"Week"&

VAR _WN = WEEKNUM([Date],1)

RETURN

IF(

_WN>52,

5,

IF(

MOD( _WN,4)=0,

4,

MOD( _WN,4)

)

),

"Days",FORMAT ( [Date], "DDDD" )

)



 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Brenden 
After adding the month number, you need to modify the sort order of months names by these numbers:

Ritaf1983_0-1685033790227.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @Brenden 
After adding the month number, you need to modify the sort order of months names by these numbers:

Ritaf1983_0-1685033790227.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

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.