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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
harry6810
Frequent Visitor

ORDER BY Statement

Hello!

I have two main datasets connected by relationships through separate tables for specific features. Is there any way to sort my power pivot from highest to lowest value with using measure? Expected result as below. Thanks in advance for any tips.  

__1.png

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @harry6810 ,

 

We can create a rank measure.

index =
RANKX ( ALL ( 'Table' ), 'Table'[Units], MAX ( 'Table'[Units] ), DESC, DENSE )

Then the result is as follows.

vtangjiemsft_1-1710141976941.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @harry6810 ,

 

We can create a rank measure.

index =
RANKX ( ALL ( 'Table' ), 'Table'[Units], MAX ( 'Table'[Units] ), DESC, DENSE )

Then the result is as follows.

vtangjiemsft_1-1710141976941.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

MattAllington
Community Champion
Community Champion

Once you have multiple measures on columns in a pivot, you can't sort them. You could try removing all measures except the one you want to sort, sort it first, then add the others. I don't know if it will work. You may be able to write a DAX query to produce the output and sort that. Here are some articles I wrote that may help

https://exceleratorbi.com.au/introduction-dax-query-language/

https://exceleratorbi.com.au/dax-query-tables-in-excel-2010/

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.