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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
BeckyXie
New Member

Matrix Columns Sorting by DAX Measure Value - Need Dynamic Column Order Based on Measure

Hi Team,
I need to sort Matrix columns dynamically​ based on a measure value (Sales), and have this sorting respond to other filters (Product). The columns are "Factory" fields, and I need them ordered from highest to lowest  Sales.
Current Limitation:​ Power BI's "Sort by column" only works on Rows, not Columns. When Factory Name is in the Columns area, how can I apply any dynamic sorting?
 
Ideal format: Factory can dynamicly adjust based on the filter for different product
BeckyXie_0-1773819732022.png

 

Thank you very much in advance!

3 REPLIES 3
danextian
Super User
Super User

@BeckyXie 

You might be able to do that with Deneb but it requires custom coding. A workaround is to rank the column header by the sales value and materialize the sales value in a table that holds the rank numbers. Use the rank as the first level in the hiearchy. It is a bit tricky to setup as well. 

danextian_0-1773837642875.gif

 





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.
BeckyXie
New Member

@FBergamaschi Thanks for your quick reply. Do you have any ideas which custom visual support this requirement?

FBergamaschi
Super User
Super User

Hi @BeckyXie 

sort by column works both in rows and columns (just checked), see image

 

FBergamaschi_0-1773821899684.png

 

but I understand what you mean, you want to use a measure for the sorting in a dynamci way and I do not believe what you ask is supported at the moment

 

You might look for a custom visual that can handle what you ask

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.