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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Lio123
Helper I
Helper I

Help with sorting the matrix

Dear developers, 

I need your help to sort the matrix visuals based on months, along with months I have some other values as well in the columns, you can put them at last after months. 

Please support.

Lio123_1-1754911247671.png

Thanks

 

2 REPLIES 2
wardy912
Solution Supplier
Solution Supplier

Hi @Lio123 

 

 It's best practice to add a date table and relate to your fact table date, here's one I made earlier!

 

Date = 
ADDCOLUMNS (
    CALENDAR (
        MIN ( [Date column from existing table] ),
        MAX ( [Date column from existing table] )
    ),
    "MonthNo", MONTH ( [Date] ),
    "MonthName", FORMAT ( [Date], "MMMM" ),
    "MonthYear", FORMAT ( [Date], "MMMM YYYY" ),
    "MonthYearShort", FORMAT ( [Date], "MMM YY" ),
    "MonthYearNo", FORMAT ( [Date], "YYYYMM" ),
    "Quarter", QUARTER ( [Date] ),
    "Year", YEAR ( [Date] ),
    "Day", DAY ( [Date] ),
    "WeekNumber", WEEKNUM ( [Date] ),
    "WeekdayNum", WEEKDAY ( [Date] ),
    "WeekdayName", FORMAT ( [Date], "DDDD" ),
    "PreviousWeek", WEEKNUM ( [Date] ) -1 ,
    "WeekStartDate", ([Date] - WEEKDAY ( [Date] , 1 ) +1),
    "WeekEndDate", ([Date] - WEEKDAY ( [Date] , 1 ) +7),
    "YearMonth", FORMAT ( [Date], "YYYY-M" )
    )

 

You can then sort the columns by my sorting columns (e.g. sort MonthName by MonthNo).

Go to the table view and select 'sort by column' from the 'column tools' toolbar.

 

wardy912_0-1754912304920.png

 

That will show the months in the right order.

 

You could add a sort column to your fact table, but a date table is definitely preferable.

 

I hope this helps, please give a thumbs up and mark as solved if it does, thanks!

 

 

mdaatifraza5556
Super User
Super User

Hi @Lio123 


Did you try creating a Month Number column in the Date table and then sorting the Month Name column by that Month Number?

Follow to get it 

Create Month No column for sorting 


Screenshot 2025-08-11 170744.png

 

 

Click on month name column and then sort by column from the ribbon and select month no.

 

Screenshot 2025-08-11 170800.png

 

 

 

Result

 

Screenshot 2025-08-11 170826.png

 




If this answers your questions, kindly accept it as a solution and give kudos.

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.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors