Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

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

3 Replies

  • Stachu's avatar
    Stachu
    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

    • Anonymous's avatar
      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 :mansad:

      • v-juanli-msft's avatar
        v-juanli-msft
        Community Support

        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"

         

        Best Regards

        Maggie