Forum Discussion
Help creating a dax measure (excluding a specific column from table)
I'm practicing my Power BI skills. 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, olympic city, etc.
The problem is that I want to create a bar graph that display country name by medal types count. However if create a graph "Country" by "Medal" from original csv it will not display the correct numbers of medals, because if a country wins a medal in a team sport (like volleyball or football) it should count as only one medal, and not the sum of all medals of all athletes in that team. This could be solved by removing Athlete column and selecting distinct values of "Event" collumn, like creating a table using the following formula:
The same number also appears if I select any medal type from filter option (Gold, Silver or Bronze).
I have no idea how to fix this. How can I create a measure that shows the correct number of medal type for every country?
- Anonymous4 years ago
HI lipao255,
You can try to use the following measure formula to get the count based on country, event, and medal group:
formula = CALCULATE ( COUNT( Table[Medal] ), ALLSELECTED ( Table ), VALUES ( Table[Country] ), VALUES ( Table[Event] ), VALUES ( Table[Medal] ) )Regards,
Xiaoxin Sheng
2 Replies
- lipao255Frequent Visitor
Up, I need some help.
- AnonymousNot applicable
HI lipao255,
You can try to use the following measure formula to get the count based on country, event, and medal group:
formula = CALCULATE ( COUNT( Table[Medal] ), ALLSELECTED ( Table ), VALUES ( Table[Country] ), VALUES ( Table[Event] ), VALUES ( Table[Medal] ) )Regards,
Xiaoxin Sheng