Forum Discussion

Radhika2605's avatar
Radhika2605
Helper II
5 years ago

Help with a visual

Hi, can someone please help me with this one?

 

I am working on an olympics database and I am trying to find out Top 5 countries with highest medals and in that visual I also want to show the different types of medals. 

 

I want to use Dax to show the Top 5 countries and don't want to use the filter pane.

 

The Dax measure which I am using to find the top 5 countries with highest medals is -

Top 5 Countries with highest medals =
CALCULATE(
[Total Medals],
FILTER(
VALUES( Country[Region] ),
RANKX( ALL( Country[Region] ), [Total Medals], , DESC ) <= 5 ))
 
I am trying to create a horizontal bar chart created as follows -
Axis - Region
Legend - Medal
Values - Top 5 Countries with highest medals
 
If I dont put the medal as legend then only 5 countries are returned as shown below:

 

 

But as soon as I put the Medal in legend then I get 6 countries instead of 5-

 

 

Can someone please guide me as to what am I doing wrong due to which 6 countries are being shown in visual instead of 5. Also, in the Top 5 Countries with highest medals measure, if I use 10 to find top 10 countries instead of top 5 and when I have medals in Legend then I get 12 results. 

 

My model -

 

 

Thanks in advance!

Radhika