Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Radhika2605
Helper II
Helper II

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:
Radhika2605_0-1629811499623.png

 

 

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

Radhika2605_1-1629811547845.png

 

 

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 -

Radhika2605_3-1629811723653.png

 

 

Thanks in advance!

Radhika

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Radhika2605 Can you share the PBIX? Going to be easier to see what is going on that way.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

Thanks for your response. Sorry file is a mess but still attaching it here.


Here is the file - 

https://drive.google.com/file/d/1WXp9F9w7cbMAr7IrtWh2Mxsj2ZlwaB70/view?usp=sharing

 

Thanks

Radhika

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.