Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Romani
Helper II
Helper II

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?

1 ACCEPTED SOLUTION

@Romani  this is another topic. Accept the solution and then we can try to fix the issue.

 

BBF

View solution in original post

30 REPLIES 30

@Romani ok, can you share the pbix file or some sample data on which you are calculating this?

Sample data - expected output.

 

BBF

Romani
Helper II
Helper II

Ranking Select = IF(
    HASONEVALUE('Ranking Selection'[Ranking]),
    VALUES('Ranking Selection'[Rank Number]),
    0
)
here is my ranking select 
Ranking  Rank Number
Top 33
Top 55
Top 1010
and this my seperated table for the ranking selection
and this the formula of AVG Ros:
Avg ROS = AVERAGE('My Table'[Return on Sales (ROS)])

@Romani ok perfect, and what is your desidered output? can you explain it with datas?

 

Thx,

BBF

I have a problem with ranking negative values in my data using DAX. Here is an example of my data:

Year Customer Name ROS

2022Client A-0.38%
2022Client B8.05%
2022Client C0.89%
2022Client D14.53%
2022Client E-3.55%
2022Client F-0.69%

I want to rank the customers based on their ROS for the year 2022. The correct ranking should be:

  1. Client D (14.53%)
  2. Client B (8.05%)
  3. Client C (0.89%)
  4. Client A (-0.38%)
  5. 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)



@Romani Ok, here my measures to correctly rank Clients as in your output:

 

Avg ROS = SELECTEDVALUE('Credit Benchmarking'[ROS.3])
Customer ROS Rank =
RANKX(
    ALL('Credit Benchmarking'[Customer Name]),
    [Avg ROS],
    ,
    DESC,
    DENSE
)
 
as you can see:
BeaBF_0-1721037380233.png

So, modify the AVG ROS.

 

BBF

to undestand well i have slicer for top achiever Capture.PNG
when iam chosing the top 5 as the above picture, the output is that showing me only top 4:
Capture.PNG
when iam pasting your DAX 

Customer ROS Rank =
RANKX(
    ALL('Credit Benchmarking'[Customer Name]),
    [Avg ROS],
    ,
    DESC,
    DENSE
) it deleting the rank selection

@Romani Ok, Clear. So we need to modify the logica.

Instead of a measure, calculate this new column and put it as tooltip on your visual:

ROS Rank =
RANKX(
    ALL('Credit Benchmarking'), 'Credit Benchmarking'[ROS.3],, DESC, Dense)
then create this measure:
Flag_TOP = IF(SELECTEDVALUE('Credit Benchmarking'[ROS Rank]) <= 'Ranking Selection'[Ranking Select], "TRUE", "FALSE")
Apply this Flag in the filter pane of your visual and set it to "TRUE".
BeaBF_2-1721039693349.png

 

 
It will work:
BeaBF_0-1721039659696.png

 

BeaBF_1-1721039674788.png

 If you send me your email, i can send you my pbix example file.

 

BBF

romani.adel93@gmail.com

Sent! Let me know.

 

BBF

BeaBF
Super User
Super User

@Romani Hi! What is Ranking Select and Avg Ros? can you paste formulas?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.