Forum Discussion
order a matrix
Hello,
I'm working on Power BI Report Server and I'm experiencing an issue when using a matrix visual.
I would like to sort my matrix in ascending or descending order, but it doesn’t seem to work.
Here is the structure of my matrix:
In the rows, I have clients (from a dimension table),
In the columns, I have a field called year_month (ex january 2025)
And in the values, I have a measure that calculates the revenue for the last 12 rolling months.
The issue is that I want to sort the columns representing the rolling months in ascending or descending order (for example: January, February, March), but it's not working as expected.
How can I make this sorting work?
Thank you in advance for your help.
Hi Anonymous ,
As a workaround, you can try using a Table visual instead of a Matrix. The Table visual allows flexible sorting by any column, including values like revenue or specific months ,which can help achieve the sorting behavior you're looking for.
Hope this helps !If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
8 Replies
- v-aatheequeCommunity Support
Hi Anonymous ,
Thanks for reaching to Microsoft Fabric Community Forum.- To display and sort monthly rolling revenue in a matrix visual, we used a DateTable with a YearMonth column (e.g., "Jan 2024") and sorted it using a numeric YearMonthNum column (e.g., 202401). This ensured chronological sorting of columns.
- A DAX measure calculated the revenue over the last 12 months using DATESINPERIOD, allowing the matrix to show clients in rows and rolling months in columns with correct totals and order.
I am sharing the sample data file for better understanding with expected output :
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.Thanks for using Microsoft Fabric Community Forum.
- AnonymousNot applicable
Thanks, that's what I did, but how can I sort the revenue by client for January 2024? I'd like client B to appear on the first row, for example. Actually, I want to be able to sort the revenue by client for each column in my matrix (by month). Normally, it's not possible to do that, and I'm trying to find an alternative.
- v-aatheequeCommunity Support
Hi Anonymous ,
for the above queries :- To ensure that Client B appears in the first row of your matrix, you can create a custom sorting column in your data model. Here’s how you can do it:
2. Yes,Power BI's Matrix visual does not natively support sorting rows on a per-column basis (i.e., sorting by month).
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!