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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SusuYes
Helper III
Helper III

Workaround to show TOP N where there are duplicates

Hello everyone, 

 

I have the following table that lists all the shifts published this year. Each shift is a separate row. 

SusuYes_1-1641882438380.png

 

I'm trying to show the Top 5 staff with the most shifts by using a Top N filter on Hours however since I have staff with the same hours, I'm getting more than 5 results. I understnad that this is where the RANKX fucniton can be useful but I was not able to apply it to my case. 


Any hints or ideas? 

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
naveenmechu
Helper I
Helper I

Hi,

Create calculated column as- 

Rank = RANKX('Table1',
'Table1'[Cost], ,,Dense
)

naveenmechu_0-1641954174226.png

You will get Dense Rank you can use it according to requirement.

 

Please mark it as as solution it soles your query.

 

 

Thanks

Naveen Mechu

I added the calculated coloumn but my graph is still showing more than 5 entries. My calculated coloumn is 'Top 5 by Hours'

SusuYes_0-1641954842546.pngSusuYes_1-1641954866951.png

 

Hi ,

Just put this Calculated Column as a simple filter and select Rank less than or equal to 5.

 

Thanks

Naveen Mechu

SusuYes_0-1641956403701.png

 

Just tried that too  but no changes happen to the visual at all. 

ALLUREAN
Solution Sage
Solution Sage

Hi, @SusuYes 

 

Try something like:

RANX Hours DENSE =
RANKX(
‘YourTable’,
‘YourTable'[Hours],
,
,
Dense
)
 
 
You can also try top5 measure like:

Top5 =
VAR TopN = 5
VAR ranks =
RANKX(
‘YourTable’,
‘YourTable'[Hours],
,
,
Dense
)

RETURN
IF ( ranks <= TopN, ranks, BLANK () )




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




I tried adding the first measure but I got this error. 

SusuYes_0-1641941179871.png

 

I tried adding SUM(TABLE NAME[Hours]) but now it's just showing the value 1 for all entries

SusuYes_1-1641941388500.png

 

 

any idea what went wrong? 

Hi,

Share the link from where i can download your PBI file.  Via text boxes, show the problem clearly and also the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello, sorry about that, can you try this: https://bit.ly/31TtAkR

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Here is a link to a sample  PBI file: https://bit.ly/3Fi1QEc

 

I want my bar graph to only show the top 5 staff who have the most hours. The bar graph should only show 5 enteries only. 

Hi,

That link has expired.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I cant share the document as it has sensitive data but I will create a sample and share soon. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.