Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Filter Top N customers using slicer

Hi everyone,

 

I have a table containes customerID and sales amount. I want use the sales amount and growth rate to create a scatter chart.  I hope that the users can select top 10, 20, 50 customers by sales amount using slicer, but I have no idea how to do it. Like if the users choose to see the top 10 customers, then the scatter plot will only shows 10 dots.

 

Can anyone help me with it? Thank you.

 

 

 

8 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous

     

    You can do this with the help of a small PARAMETER TABLE.

     

    For example, create a small PARAMETER Table like

     

    CategoryValue
    Top 55
    Top 1010
    Top 1515
    Top 2020

     

    Then  add a slicer of "Category" above

     

    Now Add a MEASURE in your DataTable which will determine if the Customers fall in the CATEGORY selected in a slicer

     

    Is Top X selected? =
    IF (
        RANKX (
            ALL ( 'DataTable' ),
            CALCULATE ( SUM ( 'DataTable'[Sales Amount] ) ),
            ,
            DESC,
            DENSE
        )
            <= SELECTEDVALUE ( ParameterTable[Value] ),
        "Yes"
    )
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Zubair_Muhammad,

         

        Thank you so much for your reply and I tried to do what you said. But I got some problem and could you please help me with it?

         

        This is what I have right now. It seems that if I choose Top 5, more than 5 customers are returned.

         

        Thank you!