cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sagdec
Helper I
Helper I

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.

 

 

 

1 ACCEPTED SOLUTION

Hi @sagdec

 

See the attached file here

 

Its a simplified example. But I hope it will help

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

8 REPLIES 8
Zubair_Muhammad
Community Champion
Community Champion

Hi @sagdec

 

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"
)

Regards
Zubair

Please try my custom visuals

Hi @sagdec

 

See the attached file here

 

Its a simplified example. But I hope it will help

 

 


Regards
Zubair

Please try my custom visuals

oh I know my mistake. Thank you very much!

Hi ,

 

 I am working on same issue , I ran in to the same problem as you . Can you please let us know how  you were able to fix it. It will help people who come to this thread with same question 

 

Thanks

Suresh

Anonymous
Not applicable

Is Top X selected? =
IF (
    RANKX (
        ALL ( 'DataTable'[Customer ID] ),
        CALCULATE ( SUM ( 'DataTable'[Sales Amount] ) ),
        ,
        DESC,
        DENSE
    )
        <= SELECTEDVALUE ( ParameterTable[Value] ),
    "Yes"
)

 

You must specify what to group them by, in this case you are ranking them by Customer.

@Anonymous   

 

Thanks , that fixed the issue. I amnot sure how the sample working with out mentioning the field to group by. 

 

Suresh Guddanti

curious what your mistake might be.. I can't get this to work at all??? the download file does not match above.. and the instructions above do not say to add a col called "is top x selected" or how it works... and ... in the downloaded file, there are 2 measures..(one called "other" and the other called "Top x" very confusing with inconsistent , incomplete instructions....

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.

 

Capture.PNGThank you!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors