Reply
Si_7777
Helper I
Helper I
Partially syndicated - Outbound

Sorting matrix table

Watch numerous video but nothiong is really showing me how to do this in Power BI.

 

I have a simple Matrix per week number 1, 2, 3 etc then under the week a product name.  The the values of sales for those products.  I want to sort the week number accending but have the products per week sorted decending by sales value.  Really easy to do in Power Pivot for Excel but cannot get t to work in Power BI.

1 ACCEPTED SOLUTION

Syndicated - Outbound

That is currently not supported. Sorting a matrix is either through a measure or row dimensions. You will need to add helper dimension from a disconnected table that returns the rank of those products by a measure.

 

In the screenshot below, Rank is the Value column from the disconnected Ranks table which is just a generated table of possible rank numbers. 

danextian_2-1736516482700.png

 

A virtual table is created to return the quantity by color and and the rank equivalent. SUMX is then use to return the filtered value from this virtual able according to the values in Rankx[Value] column. The matrix is now to be sorted by this rank dimension

danextian_0-1736516110933.png

In the screenshot below, Quantity is still the same measure but rank has been replaced with a column with invisible values, and that column has been renamed to just  a blank space. The +- icon has also been toggled off.

danextian_3-1736516618821.png

 

Please see the details in the sample pbix.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
Si_7777
Helper I
Helper I

Syndicated - Outbound

can anyone help still cant achieve this in Power BI?

danextian
Super User
Super User

Syndicated - Outbound

Hi @Si_7777 

 

In Power BI's native matrix visual, you can sort rows by either their values or row categories. However, there is no option to sort by column categories. Instead, columns are sorted chronologically or based on custom column orders in ascending order. Values are sorted by the total column rather than individual column values, while respecting the row categories. The category with the highest total value appears first, followed by the category with the second-highest value, and so on. Dimensions in lower hierarchies are sorted either in ascending or descending order relative to the dimensions in higher hierarchies.

danextian_0-1736414211800.png

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
suparnababu8
Super User
Super User

Syndicated - Outbound

Hi @Si_7777 

 

I understood that, you want to ascending the week number and products per week in descending by sales value. If you could provide the some sample data with what is your input and what is your output required in the form of any screenshots. It'll be a great to answer your questions. 

Please not that, while sharing the data don't include sensitive information.

 

Thanks

Syndicated - Outbound

This is what I am trying to achieve in Power BI.  

Si_7777_0-1736427893762.png

I have week number 38 to 41

Under each week are products.

Then they are by decending value.

 

In the above I have lmited to top 5 - so I can see top 5 by value products per week.

 

My data model is a star schema, date > fact < products

Syndicated - Outbound

That is currently not supported. Sorting a matrix is either through a measure or row dimensions. You will need to add helper dimension from a disconnected table that returns the rank of those products by a measure.

 

In the screenshot below, Rank is the Value column from the disconnected Ranks table which is just a generated table of possible rank numbers. 

danextian_2-1736516482700.png

 

A virtual table is created to return the quantity by color and and the rank equivalent. SUMX is then use to return the filtered value from this virtual able according to the values in Rankx[Value] column. The matrix is now to be sorted by this rank dimension

danextian_0-1736516110933.png

In the screenshot below, Quantity is still the same measure but rank has been replaced with a column with invisible values, and that column has been renamed to just  a blank space. The +- icon has also been toggled off.

danextian_3-1736516618821.png

 

Please see the details in the sample pbix.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Syndicated - Outbound

Wow what a workaround.  Thank you at least I l know I am not going mad.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)