Forum Discussion
raj777karthik
3 years agoMicrosoft Employee
TOPN dax function as variable
Need to show top 5 services in table visual. Service Name Count Total Count Apple 43 346 Samsumg 67 346 mi 80 346 oppo 84 346 google 72 346 Measure written we...
- 3 years ago
v-yadongf-msft
3 years agoCommunity Support
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.
raj777karthik
3 years agoMicrosoft Employee
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.