Forum Discussion

umairarshad's avatar
umairarshad
Helper II
2 years ago
Solved

Sort month in matrix Table

Hi all,

 

I need to sort months in the custom order in matrix table

April

May

June

.

.

.

March

 

 

Please help how to do it?

 

 

edit:

 

The Month column is text type.

 

 

  • Hi umairarshad ,
    Your month ( text string) should be custom sorted by another column else it will be sorted alphabetically. Create a custom sort column depends on your data model. If you have  separate dates table (which is the good practice), you can create a calculated column MONTH(datestable[date]). If you're using a column from your fact table and month name  is just the month name of a date in your fact t able, you can use the same method. If you are using that  month column that is already in  fact table and there are no dates, you need to create a custom column in Power Query say if [month] = "January" then 1 else if  [month] = "February" else 2 ... else 12

     

  • Thank you guys. I got it. Selected the month from date Hierarchy and its done. I dont know how but it worked.

     

     

     

    Thank you all.

     

    Please close this thread.

     

4 Replies

  • Hi umairarshad ,
    Your month ( text string) should be custom sorted by another column else it will be sorted alphabetically. Create a custom sort column depends on your data model. If you have  separate dates table (which is the good practice), you can create a calculated column MONTH(datestable[date]). If you're using a column from your fact table and month name  is just the month name of a date in your fact t able, you can use the same method. If you are using that  month column that is already in  fact table and there are no dates, you need to create a custom column in Power Query say if [month] = "January" then 1 else if  [month] = "February" else 2 ... else 12

     

  • Thank you guys. I got it. Selected the month from date Hierarchy and its done. I dont know how but it worked.

     

     

     

    Thank you all.

     

    Please close this thread.

     

    • danextian's avatar
      danextian
      Super User

      That will work because, in the background, it is being sorted by another column. It is good for beginners but you'll eventually learn that it isn't a good practice.