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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
160475
Helper I
Helper I

sorting months

dears 

 

i have a chart where the dates are not sorted correctlly, the date data i have are in text form JAN-DEC 

im trying to creat a new column with this DAX: Month number = month(tablename[Month]) so i can sort correctlly but when i create this column it give me this errorr : Cannot convert value 'Jan' of type Text to type Date.

 

160475_0-1647169372367.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @160475 ,

 

There is a tip to convert Month name to Month number—— combine Month name and " 1" , then change its type to DateTime, finally use MONTH() to get the number:

 

Month Number = MONTH( CONVERT( MAX('Table'[Month]) &" 1", DATETIME))

 

Eyelyn9_0-1647409627500.png

In visuals , you could apply it to Tooltips field , and then sort by it:

Eyelyn9_1-1647409720120.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @160475 ,

 

There is a tip to convert Month name to Month number—— combine Month name and " 1" , then change its type to DateTime, finally use MONTH() to get the number:

 

Month Number = MONTH( CONVERT( MAX('Table'[Month]) &" 1", DATETIME))

 

Eyelyn9_0-1647409627500.png

In visuals , you could apply it to Tooltips field , and then sort by it:

Eyelyn9_1-1647409720120.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@160475 

if you only have the text column, you can try this

Column = SWITCH('Table'[Column1],"Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Vera_33
Resident Rockstar
Resident Rockstar

Hi @160475 

 

Do you have a Date column? Month needs Date, Month number = month(tablename[Date]), even if you use SWITCH to get month number from your current text, it still has a circular dependency error...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors