Forum Discussion

jolsby's avatar
jolsby
Advocate IV
9 years ago
Solved

(Top/Bottom) 5 Slicer

I recently used this article, to dynamically change information within a slicer. Pretty cool!

 

However, I was curious if there was any tutorial for a slicer to select either the top or the bottom 5 with a [Value].

 

I was thinking of using a RANKX function while somehow making the DESC or ASC variables.

 

Is this feasible with DAX?

 

Many thanks!

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jolsby,

     

    Yes, it is possible. For detailed information, you can refer to below steps:

     

    1. Add a column to calculate the rank.

    Rank = RANKX(ALL('Table'),[Amount],,DESC,Skip)

     

     

    2. Calculate the top/bottom based on rank.

    Top/Bottom = 
    IF([Rank]<=5,"Bottom 5",if([Rank]>=MAX([Rank])-5,"Top 5","Other"))

     

     

    3. Use the Top/Bottom column as the source of slicer.

     

    BTW, the visual level filter also contains topn function.

     

    Regards,

    Xiaoxin Sheng

    • jolsby's avatar
      jolsby
      Advocate IV

      Hi Anonymous,

       

      I am unable to work this solution unfortunately, as I am calculating on my [Value] on a Calculated Measure.

       

      Error on performing measure.Using a parameter, within a new Measure causes no errors.RankTest MeasureIf I try to view the information as a column, I recieve the attached error.

       

      For context, the measure's are essentially a continuation of these demo measures.

       

      I looked into this, as a potential solution, but I wasn't seeing a proper output either.

       

      Many thanks for your assistance Xiaoxin Sheng.

       

      All my best,

       

      Jolsby

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi jolsby,

         

        All my formula are works on calculated column. Can you please share some sample data to test ?

         

        For Velarde's solution, it seems like use measure to calculate rank, then use slicer to ensure the sort mode(ASC or DESC), finally use visual level filter to filter the rank range.

         

        Regards,

        Xiaoxin Sheng