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,
I need to have a ranking to my Products based on Category and Its YTD sales.
Here is the sample data.
| Date | Product Name | Category | YTD Sales In CR |
| 23-06-2021 | ABSL Nifty 50 | Equal Weight | 300 |
| 23-07-2021 | ABSL Nifty 50 | Rregular | 200 |
| 22-08-2021 | ABSL Nifty 50 | Equal Weight | 230 |
| 21-09-2021 | ABSL Nifty 50 | Equal Weight | 350 |
| 21-10-2021 | ABSL Nifty 50 | Growth | 190 |
| 23-06-2021 | ABSL Banking And Finance | Finance | 291 |
| 23-07-2021 | ABSL Banking And Finance | Growth | 344 |
| 22-08-2021 | ABSL Banking And Finance | Finance | 53 |
| 21-09-2021 | ABSL Banking And Finance | Equal Weight | 430 |
| 21-10-2021 | ABSL Banking And Finance | Equal Weight | 540 |
| 20-11-2021 | ABSL Banking And Finance | Regular | 222 |
| 23-06-2021 | ICICI Prudential US Bluechip | Infra | 120 |
| 23-07-2021 | ICICI Prudential US Bluechip | Finance | 123 |
| 22-08-2021 | ICICI Prudential US Bluechip | Regular | 321 |
| 21-09-2021 | ICICI Prudential US Bluechip | Growth | 324 |
| 21-10-2021 | ICICI Prudential US Bluechip | Equal Weight | 244 |
Expected Output: Pease note that the Total YTD is a meausre and hence we would need measure to calcuate RANK - NOT A COLUMN - this is a subset of data we have and all this is coming from different tables so a calcuated RANK column is not going to work!
| Product Name | Cateory | Total YTD | Rank |
| ABSL Banking And Finance | Equal Weight | 970 | 1 |
| ABSL Banking And Finance | Growth | 344 | 2 |
| ABSL Banking And Finance | Finance | 344 | 3 |
| ABSL Banking And Finance | Regular | 222 | 4 |
| ABSL Nifty 50 | Equal Weight | 880 | 1 |
| ABSL Nifty 50 | Rregular | 200 | 2 |
| ABSL Nifty 50 | Growth | 190 | 3 |
| ICICI Prudential US Bluechip | Growth | 324 | 1 |
| ICICI Prudential US Bluechip | Regular | 321 | 2 |
| ICICI Prudential US Bluechip | Equal Weight | 244 | 3 |
| ICICI Prudential US Bluechip | Finance | 123 | 4 |
| ICICI Prudential US Bluechip | Infra | 120 | 5 |
Please help!
Solved! Go to Solution.
Hi @Anonymous ,
Maybe you can try this measure:
rank =
RANKX (
CALCULATETABLE (
VALUES ( 'Table'[Category] ),
ALLSELECTED ( 'Table'[Category] )
),
CALCULATE ( SUM ( 'Table'[YTD Sales In CR] ) )
)
Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Maybe you can try this measure:
rank =
RANKX (
CALCULATETABLE (
VALUES ( 'Table'[Category] ),
ALLSELECTED ( 'Table'[Category] )
),
CALCULATE ( SUM ( 'Table'[YTD Sales In CR] ) )
)
Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
worked like a beauty
@Anonymous
Here is the solution,Solved: Rank with GroupBy - Microsoft Power BI Community
Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 68 | |
| 46 | |
| 44 | |
| 29 | |
| 20 |
| User | Count |
|---|---|
| 202 | |
| 130 | |
| 102 | |
| 71 | |
| 55 |