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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
BedhiafiAmira
Frequent Visitor

Sort a matrix without adding the column

I have the following Matrix :

 

BedhiafiAmira_0-1662287795521.png

 

My measure is like below : 

 

Total_Sales = SUMX ( FactSales, FactSales[SalesQuantity] * FactSales[UnitPrice] )
 
and my DimDate contains :
  • CalendarMonthLabel
  • CalendarYear
  • CalendarMonthNumber which enables me to sort the result

How can I sort the matrix based on the CalendarMonthNumber and displaying only the CalendarMonthLabel ?

1 ACCEPTED SOLUTION
PijushRoy
Community Champion
Community Champion

Hi @BedhiafiAmira 

As I saw, your month now sort as per Alphabetic order
So you need to create a calculated column in your DimDate table, please change DAX as per your month column name

MONTH_SORT = 
Switch(
True(),
Month = "January",1,
Month = "February",2,
Month = "March",3,
Month = "April",4,
Month = "May",5,
Month = "June",6,
Month = "July",7,
Month = "August",8,
Month = "September",9,
Month = "October",10,
Month = "November",11,
Month = "December",12)

 I used calendar month scquence, if your year start from June, so you need to put June as 1 

 

Then click on your MONTH column and select SORT_MONTH column 
01.png

 

Now click on table matrix visual change sory by month column

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

4 REPLIES 4
PijushRoy
Community Champion
Community Champion

Hi @BedhiafiAmira 

As I saw, your month now sort as per Alphabetic order
So you need to create a calculated column in your DimDate table, please change DAX as per your month column name

MONTH_SORT = 
Switch(
True(),
Month = "January",1,
Month = "February",2,
Month = "March",3,
Month = "April",4,
Month = "May",5,
Month = "June",6,
Month = "July",7,
Month = "August",8,
Month = "September",9,
Month = "October",10,
Month = "November",11,
Month = "December",12)

 I used calendar month scquence, if your year start from June, so you need to put June as 1 

 

Then click on your MONTH column and select SORT_MONTH column 
01.png

 

Now click on table matrix visual change sory by month column

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





I had to use another calculated column : 

MonthNameToBeUsedInSorting = DimDate[CalendarMonthLabel] 
 As I was using month name in creating the sort column I can not use that as a sort column

I am getting a circular dependency when I try to sort the month by the calculated column.

tamerj1
Community Champion
Community Champion

Hi @BedhiafiAmira 

from the table view select the month label column and click on "sort by column". From the drop down list select "month number". 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.