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
Hi Team,
Please find in Screenshot 1. When I use rank based on category then it is working absolutely fine. but as soon as I add sub category in to the report then it is not showing correct values(Screenshot 2).
Could you please help me with this?
Regards,
RSD
Solved! Go to Solution.
Hi @Anonymous ,
If you just want to comply in sub-category, you can try this measure:
Measure = RANKX(ALL(Orders),CALCULATE(SUM(Orders[Profit])),,DESC,Dense)
And you will get the following result:

If you want to comply the rank in both tables, you can try this measure :
Profit Ranks = IF(ISINSCOPE('Orders'[Sub-Category]),RANKX(ALLSELECTED(Orders),CALCULATE(SUM(Orders[Profit])),,DESC,Dense),RANKX(ALLSELECTED(Orders[Category]),CALCULATE(SUM(Orders[Profit])),,DESC,Dense))
And you will get the following result:

Here is a demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
If you just want to comply in sub-category, you can try this measure:
Measure = RANKX(ALL(Orders),CALCULATE(SUM(Orders[Profit])),,DESC,Dense)
And you will get the following result:

If you want to comply the rank in both tables, you can try this measure :
Profit Ranks = IF(ISINSCOPE('Orders'[Sub-Category]),RANKX(ALLSELECTED(Orders),CALCULATE(SUM(Orders[Profit])),,DESC,Dense),RANKX(ALLSELECTED(Orders[Category]),CALCULATE(SUM(Orders[Profit])),,DESC,Dense))
And you will get the following result:

Here is a demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
I removed calculate and worked for me
Measure = RANKX(all('Order'[category]),(sum('Order'[profit])),,DESC,Dense)
name changed as per data I have. Link
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi @amitchandak ,
Thanks for your help but after removing Calculate it's showing Rank '1' for all the values. I want to keep ranking based on profit.
Regards.
RSD
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 33 | |
| 32 | |
| 31 | |
| 26 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |