Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Top N value based on category

Hello I need help to have filter for top N for  column "Values" for each category. if I can have button for top 2 values and once I  select a slicer filter for category  = New, it show me all the col...
  • v-yalanwu-msft's avatar
    4 years ago

    Hi,  Anonymous ;

    You could create a flag measure.

    Flag = IF( RANKX(FILTER(ALLSELECTED('Table'),[Category]=MAX('Table'[Category])),CALCULATE(SUM('Table'[Value])),,DESC)<=2,1)

    Then apply it into filter.

    The final show:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.