Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I am trying to rank agents by sales based on selected date range
I have this rank formula
Hi @Anonymous ,
The issue you're facing with duplicate rankings, even when the RevenueSum values are different, is likely due to floating-point precision or the lack of a unique tiebreaker. To resolve this, you can enhance your ranking formula by adding a tiebreaker that ensures uniqueness. This can be achieved by incorporating a unique identifier for each agent, such as their Agent ID, into the ranking logic. Here's the updated formula:
Rank =
RANKX(
ALLSELECTED('Agent List'),
CALCULATE(SUM(Query1[RevenueSum])) + DIVIDE(UNIQUEVALUE('Agent List'[Agent ID]), 1000000),
,
ASC,
Skip
)
In this formula, the primary ranking is still based on the RevenueSum, but by adding the agent's unique ID (scaled down to a negligible value), you introduce a secondary criterion to break ties. The division ensures that the ID doesn't significantly alter the primary ranking while still differentiating agents with similar RevenueSum values. If the issue persists, you can also round the RevenueSum values in the formula to ensure consistent precision, as shown below:
Rank =
RANKX(
ALLSELECTED('Agent List'),
ROUND(CALCULATE(SUM(Query1[RevenueSum])), 2) + DIVIDE(UNIQUEVALUE('Agent List'[Agent ID]), 1000000),
,
ASC,
Skip
)
This ensures that any minor inconsistencies caused by floating-point precision are eliminated. These changes should resolve your issue and ensure accurate ranking across all scenarios, including when filtering by a date range. Let me know if you encounter any further challenges.
Best regards,
Thanks for the help...however, I still can't get it to work. UNIQUEVALUE doesn't appear to be an option to use in my version. I tried it with DISTINCT and I get an error saying "multiple values were supplied when a single value was expected"
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |