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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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