The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Everyone,
I am trying to rank my order code data by the Avg. Xyz using the below DAX Formula. However when the I return the results I am seeing duplicate rank values (example below). Any suggestion on how to eliminate this issue?
Ranking = RANKX(
ALLSELECTED(detail),
CALCULATE(SUM(detail[avg_xyz])),
,DESC,Skip
)
Solved! Go to Solution.
Hi @Suman8877
You’re seeing duplicate ranks because RANKX is giving the same rank when two values are equal. By default you used Skip, which leaves gaps. You have two options:
Ranking =
RANKX (
ALLSELECTED ( detail[OrderCode] ),
CALCULATE ( SUM ( detail[avg_xyz] ) ),
,
DESC,
DENSE
)
HI @Suman8877 ,
The issue of duplicate rank values in RANKX typically happens because the ranking expression returns the same result for multiple items, causing ties.
Your current formula:
Ranking = RANKX(
ALLSELECTED(detail),
CALCULATE(SUM(detail[avg_xyz])),
,
DESC,
Skip
)
returns the same rank for items with identical sums, which is expected with the Skip option since it skips rank numbers for ties but doesn't differentiate tied values.
Use DENSE ranking instead of SKIP if you want consecutive ranking but still handle ties:
Ranking = RANKX(
ALLSELECTED(detail),
CALCULATE(SUM(detail[avg_xyz])),
,
DESC,
Dense
)
This won't create unique ranks but avoids gaps/skips in ranks.
Please mark this post as solution if it helps you. Appreciate Kudos.
Hi @Suman8877
You’re seeing duplicate ranks because RANKX is giving the same rank when two values are equal. By default you used Skip, which leaves gaps. You have two options:
Ranking =
RANKX (
ALLSELECTED ( detail[OrderCode] ),
CALCULATE ( SUM ( detail[avg_xyz] ) ),
,
DESC,
DENSE
)
User | Count |
---|---|
14 | |
12 | |
7 | |
6 | |
5 |
User | Count |
---|---|
28 | |
18 | |
13 | |
7 | |
5 |