Forum Discussion
Anonymous
4 years agoNot applicable
TOP 10 countries using DAX code
Hello Experts, I want to help me to write the DAX code to show only the TOP 10 Countries based on Revenue.
- 4 years ago
Anonymous it should work :))
What is [Att_Value1]? Is that a column or a measure?
- 4 years ago
Anonymous no worries ๐
This is for the scenario where the total is for all (just change it to your names and 10 instead of 3):Top 3 Countries By Sales = VAR _countries = TOPN(3, ALLSELECTED(Customer[Country]),[Sales Amount]) RETURN IF( ISINSCOPE(Customer[Country]), CALCULATE( [Sales Amount], KEEPFILTERS(_countries) ), [Sales Amount] )
SpartaBI
4 years agoCommunity Champion
Anonymous
Top 10 Countries By Revenues =
VAR _top10_countries = TOPN(10, ALLSELECTED('Table'[Country]),[Revenues Measure])
RETURN
CALCULATE(
[Sales Amount],
KEEPFILTERS(_top10_countries)
)