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, I'm having trouble creating rank for my data.
Here's the table I'm using.|
Here's the DAX measure I created.
I'm sure I made a mistake in the code but not sure what.
PurchasedFrom table is linked to trackList and SalesAmt is also linked to TrackList.
Tracklist contains millions of records and so the $ is accurate but I just can't get the Ranking to work properly.
Solved! Go to Solution.
Hi @StevenT,
Please try the below measure:
Rank =
RANKX(
ALL('PurchasedFrom'),
CALCULATE(SUM('TrackSales'[SalesAmt])),
DESC,
DENSE
)
Try
Ranking =
VAR PurchasedFromWithSales =
ADDCOLUMNS (
ALLSELECTED ( 'PurchasedFrom'[pkPurchasedFrom] ),
"@sales", CALCULATE ( SUM ( 'TrackSales'[SalesAmt] ) )
)
VAR Result =
RANK ( DENSE, PurchasedFromWithSales, ORDERBY ( [@sales], DESC ) )
RETURN
Result
Try
Ranking =
VAR PurchasedFromWithSales =
ADDCOLUMNS (
ALLSELECTED ( 'PurchasedFrom'[pkPurchasedFrom] ),
"@sales", CALCULATE ( SUM ( 'TrackSales'[SalesAmt] ) )
)
VAR Result =
RANK ( DENSE, PurchasedFromWithSales, ORDERBY ( [@sales], DESC ) )
RETURN
Result
Hi @StevenT,
Please try the below measure:
Rank =
RANKX(
ALL('PurchasedFrom'),
CALCULATE(SUM('TrackSales'[SalesAmt])),
DESC,
DENSE
)
Thanks very much for your help!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |