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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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