Forum Discussion
Filter Top N customers using slicer
- 8 years ago
Hi Anonymous
You can do this with the help of a small PARAMETER TABLE.
For example, create a small PARAMETER Table like
| Category | Value |
| Top 5 | 5 |
| Top 10 | 10 |
| Top 15 | 15 |
| Top 20 | 20 |
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"
)- Anonymous8 years agoNot 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!
- Anonymous8 years agoNot applicable
oh I know my mistake. Thank you very much!
- erichard008 years agoFrequent Visitor
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....
- venkatasuresh_g6 years ago
Helper IV
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
- Anonymous6 years agoNot 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.