Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I'm practicing my Power BI skills, thus I've downloaded a csv file which contains data about olympic games. The dataset has many columns, such as country, athlete name, year, sport, event, medal which the athlete has won, city, etc.
The problem is that I want to create a bar graph showing country name by medal types count. However if I just select the columns the graph will not display the correct numbers of medals, because if a country won a medal in a team sport (like volleyball or football) it should count as only one medal, and not the sum of medals of all athletes in that team. This could be solved by removing Athlete column and selecting distinct values of "Event" collumn.
csv file
I tried to create a measure like
hi.
that is strange but i work on the same table and have the same problem.
the solution is you should first determine the year and the country, and if you see the Event filed in team sports are duplicated somewhere then you sould use DISTINCTCOUNT('table' [Event]) to remove duplicate and enumerate rest of rows. for example i write a code to retrieve all gold medal of U.S.A in olympic 2016.
number of gold = CALCULATE(DISTINCTCOUNT(athlete_events[Event]),FILTER(athlete_events,athlete_events[Medal]="Gold"),FILTER(athlete_events,athlete_events[Year]=2016),FILTER(athlete_events,athlete_events[NOC]="USA"))
i write the same code for silver and bronze medal and draw the chart.
Hi @lipao255 ,
Could you pls share your pbix file and remember to remove confidential data.
Best Regards
Lucien
try the below measure.
Gold count = countx(filter('table',[medal]="Gold"),distinct(event))
Try it and share your opinion.
regards,
Atma.
How do I apply a measure into a graph? It shows a error similar to the third image.
Please, I really have no idea how to solve this
I really need some help.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
79 | |
58 | |
35 | |
34 |
User | Count |
---|---|
99 | |
59 | |
56 | |
46 | |
40 |