Forum Discussion
TOP Achiever Analysis
I have an issue I couldn't solve because I have negative values in my data, and the DAX below cannot rank it. For example, when ranking the ROS KPI and choosing the top 5, it shows only 4. I don't know why. Here is a sample of my data:
Year | Customer Name | ROS
2022 | Client A | -0.38%
2022 | Client B | 8.05%
2022 | Client C | 0.89%
2022 | Client D | 14.53%
2022 | Client E | -3.55%
2022 | Client F | -0.69%
Top Avg ROS by Rank =
VAR RankingDimension = VALUES('Credit Benchmarking'[Customer Name])
VAR RankingSelect = [Ranking Select]
RETURN CALCULATE( [Avg ROS], FILTER( RankingDimension, RANKX(ALL('Credit Benchmarking'[Customer Name]), [Avg ROS], , DESC,Dense) <= RankingSelect ))
Can you help me resolve this issue?
30 Replies
- RomaniHelper IIRanking Select = IF(HASONEVALUE('Ranking Selection'[Ranking]),VALUES('Ranking Selection'[Rank Number]),0)
here is my ranking select
Ranking Rank Number
and this my seperated table for the ranking selectionTop 3 3 Top 5 5 Top 10 10
and this the formula of AVG Ros:Avg ROS = AVERAGE('My Table'[Return on Sales (ROS)])- BeaBFSuper User
- RomaniHelper II
I have a problem with ranking negative values in my data using DAX. Here is an example of my data:
Year Customer Name ROS
2022 Client A -0.38% 2022 Client B 8.05% 2022 Client C 0.89% 2022 Client D 14.53% 2022 Client E -3.55% 2022 Client F -0.69% I want to rank the customers based on their ROS for the year 2022. The correct ranking should be:
- Client D (14.53%)
- Client B (8.05%)
- Client C (0.89%)
- Client A (-0.38%)
- Client F (-0.69%)
However, my dashboard is only showing 4 customers when I select the top 5. How can I fix this so it shows all 5 customers correctly, including the ones with negative values?
i Think the problem with my dax especially the below part:RANKX(ALL('Credit Benchmarking'[Customer Name]), [Avg ROS], , DESC,Dense)
- RomaniHelper II
Well received.
However, the ranking slicer is not affecting the visual as expected. The client has multiple ROS values spanning two or three years, and I also have a slicer for the year.
When I apply your solution, it displays all the clients regardless of selecting the top 3, 5, or 10. Additionally, when I choose a specific year, the output disappears.
- BeaBFSuper User
Romani ok, so modify your calculated column as:
ROS Rank_year =VAR CurrentYear = 'Credit Benchmarking'[Year]RETURNRANKX(FILTER(ALL('Credit Benchmarking'),'Credit Benchmarking'[Year] = CurrentYear),'Credit Benchmarking'[ROS.3],,DESC,Dense)
than substitute this in the tooltip and also in the Flag_TOP measure.BBF- BeaBFSuper User