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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Deb3107
Frequent Visitor

Sorting rows and columns in matrix visual

Hi,

 

hoping someone can help me. I have a matrix with columns and rows and calculated values.

 

My client wants to be able to sort the rows in a specific order and then the values in descending order so the column Starting a Grant would be at the far left.  I've managed to sort the trading status in pie charts and bar charts with only 1 dimension by creating a measure for each trading status and then adding as values and re-ordering that way.  I can't seem to find a weay of doing this for the matrix though.

 

Enquiry Reason Trading Status.png

The below is a chart I have used measures for each of the trading status

 

Trading Status.png

 

Any help would be much appreicated.

 

Debra

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

hi, @Deb3107 

Add a conditional calculate column by dax in Summary table

3.JPG

For example: 

For sort=IF([Trading Status] ="Pre-Start",1

IF([Trading Status] ="Established 1-3 years",2

IF([Trading Status] ="Established 3-10 years",3

IF([Trading Status] ="Established >10 years",4))))

...

If there is other attribute, keep the same logic in the formula

Then use selected [Trading Status] filed in the right fields pane->Click Sort by Column->choose the new column.

4.JPG

https://radacad.com/sort-by-column-in-power-bi

 

Best Regards,

Lin

Community Support Team _ Lin
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

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @Deb3107 

You could get it by using the Sort by Column button in power bi desktop, for more detail see below:

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-butto...

https://radacad.com/sort-by-column-in-power-bi

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lili6-msft 

 

I don't appear to have the options when clicking on the 3 dots to revert back to default sort order so I get an error saying "this ccolumn can't be sorted by a column that is sorted,directly or indirectly, another column".

 

Sort options.png

The table I'm trying to sort is a Summary table created by using the SUMMARIZE funtion so I can't use the Query editor either that is suggested here https://community.powerbi.com/t5/Desktop/Sort-by-another-column-error/td-p/61341

 

I'm at a bit of a loss of what to do now and reports need to go live this week.

 

hi, @Deb3107 

Add a conditional calculate column by dax in Summary table

3.JPG

For example: 

For sort=IF([Trading Status] ="Pre-Start",1

IF([Trading Status] ="Established 1-3 years",2

IF([Trading Status] ="Established 3-10 years",3

IF([Trading Status] ="Established >10 years",4))))

...

If there is other attribute, keep the same logic in the formula

Then use selected [Trading Status] filed in the right fields pane->Click Sort by Column->choose the new column.

4.JPG

https://radacad.com/sort-by-column-in-power-bi

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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