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
Anonymous
Not applicable

RANKX returns duplicates

Hi all,

 

i've searched this forum endlessly, but somehow i can't figure out how to resolve this problem.

I have a table with problem causes (Aanleiding in Dutch) and i want to show only the TOP 5 causes. So i started with simply adding a TOP N to the Aanleiding field, but then i found out that it shows 6 values, because the bottom 2 values are 20 times present in the table. Can anyone please help me out to only show the TOP5?

 

Formula: 

TOP5 = RANKX(ALLSELECTED(DSO_KLANTVRAGEN[aanleiding]);CALCULATE(COUNT(DSO_KLANTVRAGEN[aanleiding]));;DESC;Dense

Capture.PNG

3 REPLIES 3
Stachu
Community Champion
Community Champion

right now you use the visual TopN filter, which probably uses built in rank, not the one you written

instead, can you filter the TOP5 measure, for values that are <=5?
that will work, assuming that the Dense at the end of RANKX give you the ranks with no ties



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Hi Stachu,

 

i've removed the TOP N filter as you said and added the TOP5 to the filtering using <=5. But unfortunately it still shows the same 6 items Man Sad

Hi @Anonymous

If you only want to show Top5 with only 5 values

Modified the formula as below

Measure 2 = IF(HASONEVALUE(Sheet1[as]),RANKX(ALLSELECTED(Sheet1),[Measure],,DESC))

create an index column from 1 in the query editor, then add [Index] column to the Visual Filter container and apply "is less than or equal to 5"

5.png

6.png

 

Best Regards

Maggie

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.