Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello Everyone,
I'm doing the power BI lab, I have ameasure total sale like below:
And I would like to use RANKX function to rank the Category by total sale:
Solved! Go to Solution.
Hi @thangdev
In the 2nd formula CALCULATE is missing to perform context transition.
While in the 1st formula you referenced a measure and all measures are automatically wrapped with an implicit CALCULATE therefore, automatically perform context transition.
You can use either of the following
=
RANKX (
ALLSELECTED ( Categories ),
SUMX (
CALCULATETABLE ( 'Order Details' ),
'Order Details'[Quantity] * 'Order Details'[UnitPrice]
),
,
ASC
)=
RANKX (
ALLSELECTED ( Categories ),
CALCULATE (
SUMX ( 'Order Details', 'Order Details'[Quantity] * 'Order Details'[UnitPrice] )
),
,
ASC
)
Hi @thangdev
In the 2nd formula CALCULATE is missing to perform context transition.
While in the 1st formula you referenced a measure and all measures are automatically wrapped with an implicit CALCULATE therefore, automatically perform context transition.
You can use either of the following
=
RANKX (
ALLSELECTED ( Categories ),
SUMX (
CALCULATETABLE ( 'Order Details' ),
'Order Details'[Quantity] * 'Order Details'[UnitPrice]
),
,
ASC
)=
RANKX (
ALLSELECTED ( Categories ),
CALCULATE (
SUMX ( 'Order Details', 'Order Details'[Quantity] * 'Order Details'[UnitPrice] )
),
,
ASC
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 17 | |
| 10 | |
| 10 | |
| 7 | |
| 7 |