Forum Discussion
AndreasHermle
1 year agoRegular Visitor
Retrieve Top5 Countries Total from a table visual and have it displayed in a card visual?
Dear Experts: I have got a table visual as follows: It shows the Top 5 Countries by Category Sales. along with a Ranking Column. It works just fine. The two measures Top5Countries and R...
- 1 year ago
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
In this case, one of ways is using WINDOW and RANK DAX functions in measures.
Please check the below picture and the attached pbix file.
WINDOW function (DAX) - DAX | Microsoft Learn
RANK function (DAX) - DAX | Microsoft Learn
Total sales: = SUM(sales[sales])Top 5 countries within category: = VAR _topn = WINDOW ( 1, ABS, 5, ABS, SUMMARIZE ( ALL ( sales ), category[category], country[country] ), ORDERBY ( [Total sales:], DESC ), , PARTITIONBY ( category[category] ) ) RETURN CALCULATE ( [Total sales:], KEEPFILTERS ( _topn ) )Ranking: = IF ( [Top 5 countries within category:], RANK ( SKIP, SUMMARIZE ( ALL ( sales ), category[category], country[country] ), ORDERBY ( [Total sales:], DESC ), , PARTITIONBY ( category[category] ) ) )
v-kpoloju-msft
Community Support
1 year agoHi AndreasHermle,
May i know has your issue been resolved? If the response provided by the community member Jihwan_Kim, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
If yes, kindly accept the useful reply as a solution and give us Kudos. It would be appreciated.
Thank you for your understanding!