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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
likhithar
Helper III
Helper III

RANKX With Ties for Dynamic TOPN

Hello All,

  I have Meetings Completed to Meetings Assigned  by employee wise, Dividing Meetings Completed/Meetings Assigned gives me the Ratio.

The Ratio is having Ties with multiple employees,means Emp A,B,C,D,E has Ratio as 1 and if give Top 3 from Numeric Range(What if Parameter) it's showing all the Emp's who is having Ratio 1.

I used the following DAX in Power BI

Ratio = SUM(Sheet1[Meetings Completed])/SUM(Sheet1[Meetings Assigned])
RANKX =
CALCULATE([Ratio],
FILTER(VALUES(Sheet1[Emp Name]),
RANKX(ALL(Sheet1[Emp Name]),[Ratio],,DESC)<=SELECTEDVALUE(Parameter[Parameter])))
likhithar_1-1653282352096.png

 

I used RAND function ,it's working but it's Static Scenario,means from Filter Name have to select Bottom 5 ,10 etc for Top Emp.
Rank_NEW =
RANKX(ALL(Sheet1[Emp Name]),[Ratio],,DESC)+RAND()
likhithar_0-1653282243492.png

 

 Here is the Data snap 
likhithar_2-1653282521395.png
The tried the below article also,But didn't met my scebnario

Help me out on this

TIA

2 ACCEPTED SOLUTIONS

Record_2022_05_25_09_44_54_251.gif


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

isabella
Employee
Employee

Hi @likhithar 

You can add index column in power query to solve this issue,here are my steps,you can take a reference:

Go into the power query

isabella_0-1653631135265.png

 

Then sort met ratio field

isabella_1-1653631135267.png

 

Then sort emp name field

isabella_2-1653631135269.png

 

 

Then add index column from 1 

isabella_3-1653631135269.png

 

 

Now the data look as:

isabella_4-1653631135270.png

 

 

in visualization,use the index field to create the slicer

 

isabella_5-1653631135271.png

 

Best Regards,

Community Support Team _Isabella

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
isabella
Employee
Employee

Hi @likhithar 

You can add index column in power query to solve this issue,here are my steps,you can take a reference:

Go into the power query

isabella_0-1653631135265.png

 

Then sort met ratio field

isabella_1-1653631135267.png

 

Then sort emp name field

isabella_2-1653631135269.png

 

 

Then add index column from 1 

isabella_3-1653631135269.png

 

 

Now the data look as:

isabella_4-1653631135270.png

 

 

in visualization,use the index field to create the slicer

 

isabella_5-1653631135271.png

 

Best Regards,

Community Support Team _Isabella

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653291184804.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Hi @CNENFRNL 

Thanks for the Reply..My Requirement is If I select Rank 3, it has to show 3 Employees only who are with 100% in the above scenario(Ex: It might be A,B,C).Is it possible to achieve??

Record_2022_05_25_09_44_54_251.gif


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL It worked perfectly!!!Thank You 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.