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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pardeepd84
Helper III
Helper III

how to convert month name to number in matrix

Hi,

 

I am trying to create a matrix to show the months and cost however the month is being sorted in alphabetical order rather than in chronologica order.  I need it to show as Jan, Feb, March etc however it is being sorted as April, August, December.

 

Please could I have some assistance with this. 

 

Thank you

1 ACCEPTED SOLUTION

Hi @pardeepd84 

Are these two columns both calculated columns? you can duplicate one column and use that column to sort Month column. or add Index column, and use it to sort Month column.

in my test, I use Date column to sort Month column, it works fine.

vxiaotang_0-1629957106742.png

 

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

7 REPLIES 7
pardeepd84
Helper III
Helper III

I have tried this but get the following error message:

 

pardeepd84_1-1629889111962.png

 

 

 

Hi @pardeepd84 

Are these two columns both calculated columns? you can duplicate one column and use that column to sort Month column. or add Index column, and use it to sort Month column.

in my test, I use Date column to sort Month column, it works fine.

vxiaotang_0-1629957106742.png

 

 

Best Regards,

Community Support Team _Tang

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

Is your date table a Dax built table or did you do it in power Query? In fact do you have a seperate date table? This is a highly recommended thin to do.

Cicular dependancy means you are using something that is relying on your current measures. 

 

Do you have the column I mentioned for sorting? ie a column that returns the month number in your table? Can you screen grab your date table?

Ashish_Mathur
Super User
Super User

Hi,

Please read this article - Sort one column by another column in Power BI Desktop.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
pardeepd84
Helper III
Helper III

I have tried this by when I create a matrix I get this:

 

pardeepd84_1-1629753037954.png

 

 

 

 

 

I think I know what it is. you need a column for sort order that you want.

 

So I have a column called sort and I start the month number from where I want it. So fiscal year I make April

 

'Month FY Sort = if('01_Calendar'[MonthOfCyear]>=4,'01_Calendar'[MonthOfCyear]-3, '01_Calendar'[MonthOfCyear]+9)"
 
Then highlight your onth number column and click the Sort by button. You need to change that to the new sort number column
 
Pmorg73_0-1629753443605.png

 

 
Pmorg73
Post Patron
Post Patron

Do you have a date table?

Mine is a DAX one. If so make a new column

 

Month no = FORMAT('Date table'[date], "M")

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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