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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
AlwaysLearn
Frequent Visitor

How to sort multiple columns separately

Hi,

 

I would like to explore following scenario:

I have monthly progress variance for 100 projects. For filtered year (e.g. selected year 2023) from Jan to Dec, sort descending by larger delay variance at the tops for each month in a table or matrix then show the project names accordingly.

 

Is it able to do so?

 

 

2 ACCEPTED SOLUTIONS
shafiz_p
Super User
Super User

Hi, @AlwaysLearn  You can sort multiple columns in table using "Shift + Left clicking" the column header. Left click again for opposite direction. You can then convert the table to matrix if you want.

 

 

If this solved your problem, please mark it as a solution!!

View solution in original post

Anonymous
Not applicable

Hi @AlwaysLearn 

 

Please try this:

Here I create a set of sample:

vzhengdxumsft_0-1722217769795.png

Then add a calculated column:

Column = 
	ROWNUMBER(ORDERBY(
		'Table'[Month],
		ASC,
		'Table'[Values],
		DESC
	))

vzhengdxumsft_1-1722217830226.png

Then you can sort the matrix or table visual by this column, the result is as follow:

vzhengdxumsft_2-1722218132999.png

ROWNUMBER function (DAX) - DAX | Microsoft Learn

ORDERBY function (DAX) - DAX | Microsoft Learn

 

Best Regards

Zhengdong Xu
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

5 REPLIES 5
JustSayJoe
Advocate IV
Advocate IV

Step 1: In your Matrix, add a field to the row hierarchy (which you will later remove).

Step 2: Change the Matrix to a Table visual.

Step 3: Sort all the columns you wish to sort, and in the order you wish them to be sorted.

Step 4: Delete the field you previously added in Step 1 from the table.

Step 5: Change the Table back to a Matrix visual.

Step 6: Ensure the right fields are back in the Row hierarchy.

 

This will maintain your multiple sorted fields within your matrix, even when you expand your row hierarchies.

Anonymous
Not applicable

Hi @AlwaysLearn 

 

Please try this:

Here I create a set of sample:

vzhengdxumsft_0-1722217769795.png

Then add a calculated column:

Column = 
	ROWNUMBER(ORDERBY(
		'Table'[Month],
		ASC,
		'Table'[Values],
		DESC
	))

vzhengdxumsft_1-1722217830226.png

Then you can sort the matrix or table visual by this column, the result is as follow:

vzhengdxumsft_2-1722218132999.png

ROWNUMBER function (DAX) - DAX | Microsoft Learn

ORDERBY function (DAX) - DAX | Microsoft Learn

 

Best Regards

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

shafiz_p
Super User
Super User

Hi, @AlwaysLearn  You can sort multiple columns in table using "Shift + Left clicking" the column header. Left click again for opposite direction. You can then convert the table to matrix if you want.

 

 

If this solved your problem, please mark it as a solution!!

Hi @shafiz_p 

Am I right to say, I need to adjust at data modelling level, instead of looking at report/chart level?

Ritaf1983
Super User
Super User

Hi @AlwaysLearn 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

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

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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