Forum Discussion
TOPN dax function as variable
- 3 years ago
Hi raj777karthik ,
If you don't want to create a new table, pleaser try following DAX to sort [Thread_] column:
Rank = RANKX('Stack Tags','Stack Tags'[Thread__],'Stack Tags'[Thread__],DESC)
Calculate the sum of the top 5:
Total count = CALCULATE(SUM('Stack Tags'[Thread__]),FILTER(ALL('Stack Tags'),'Stack Tags'[Rank]<=5))
Add the [Rank] column to Filters to filter out the top5:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
In this since my service oppo has 84 count the rank is taking all these for 1 and second service mi has 80 count ,rank is taken as 85 .And for third its taking as rank 165.
- v-yadongf-msft3 years agoCommunity Support
Hi raj777karthik ,
Please try following DAX to create three measures:
Count = COUNT('Stack Tags'[Service]) Rank = RANKX(ALLSELECTED('Stack Tags'),[Count],,DESC,Dense) Total count = CALCULATE([Count],FILTER(ALL('Stack Tags'),'Stack Tags'[Rank]<=5))You will get result you want:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- raj777karthik3 years agoMicrosoft Employee
In Rank measure,im getting values 1 and 2.
- v-yadongf-msft3 years agoCommunity Support