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
Anonymous
Not applicable

sorting by two rows in a matrix

Hello,

 

I can't seem to find a solution on this... assuming there is some sort of workaround that I can do (I expect that I can, but who knows).

 

My problem is that I need to sort a matrix in descending order by a number of searches, but when you expand the first row, the second row will be sorted by date descending.

 

Note: the names are marked out for privacy.

So it currently looks like this:

Collapsed:

capture2.PNG

Expanded:

capture.PNG

 

The goal is to keep it descending by 'Number of Searches', but when you expand the name, the dates will be in descending order (regardless of number):

Name Number of Searches
Name 132
 9 March, 20214
 8 March, 202160
 5 March, 202148
 4 March, 20219
 3 March, 202111
Name 80
 9 March, 202141
 4 March, 202118
 1 March, 202120
 26 February, 20211
Name 4
 5 March, 20211
 25 February, 20213

 

You can choose to sort the matrix by the 'Date' if you expand the rows that contain dates, but this puts all of the names in alphabetical order and overrides the oringal sort by 'Number of Searches'.

 

Thanks for any help that can be provided.

 

Edit: Both 'Name' and 'Date' fields are in the Rows section. There is nothing in the column section of the visual pane. 

'Number of Searches' is a measure in the values section.

I've tried sorting by an index column, grouping columns, etc., and nothing has worked so far. If anyone knows if there's a work around, it would be much appreciated.

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Do you want to sort the matrix data by the field Date descending? If yes, you can follow the steps in the below screenshot to set it. Otherwise, please provide more details about your requirement. Thank you.

yingyinr_0-1616120763637.png

Best Regards

Anonymous
Not applicable

Hi @Anonymous ,

 

I want to sort both by the number of searches in descending order, and then when you click the '+' to expand a row, those dates that the searches took place would be in descending order, regardless of how many searches there were.

 

So, sort by number of searches descending when the rows are collapsed; 

sort by date descending when the rows are expanded BUT keep the sort descending by number of searches on the upper heirarchy.

 

I'd also like to add that clicking on the ellipses and then sorting by the date removes the sorting by descending number of searches.

It puts the names in alphabetical order, which isn't the goal.

 

I hope that makes sense! 

If it's not possible, I'll just try to give these results in a different way.

Anonymous
Not applicable

Hi @Anonymous ,

This may require you to make sort settings for two times:
1. When there is only one hierarchy level Name in matrix, select the More options (...) menu in the upper right corner of the matrix, then select Sort descending and select Sort by, and then select the field Number of Searches

yingyinr_2-1616665974041.png

2. When you click the "+" in front of Name to expand the data, select the More options (...) menu in the upper right corner of the matrix, then select Sort descending and select Sort by, and then select the field Date

yingyinr_0-1616665825549.png

Best Regards

Anonymous
Not applicable

@Anonymous 

Apologies for the late response--it's been a busy week!

 

Unfortunately, I've tried this, and it normally overwrites the previous sort by Number of Searches.

I will try again though and let you know!

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.