Rolando
Rolando

Reputation: 62596

How to have pie chart count based on distinct values of a column in Tableau?

In a database table I have something like this:

RatingID, StudentID, Sport, Rating
1, 1,     Tennis, 2
2, 1,     Tennis, 5
3, 2,     Basketball, 2
4, 2,     Basketball, 5
5, 3,     Basketball, 2

I want a pie chart that counts up how many people are playing each sport. Currently, I am getting a pie chart using "Sport" that says:

BasketBall: 3
Tennis: 2

When I attempt to do a Distinct(SPORT), it says 1 for both. What I want to do is to be able to do a distinct on StudentID such that the pie chart says:

Tennis: 1
Basketball: 2

How can I do this? Is it possible?

Upvotes: 2

Views: 4750

Answers (1)

Nick
Nick

Reputation: 7431

You need to do a COUNTD on StudentID not Sport. You would use Sport in the color card and the label card.

Like so:

enter image description here

Upvotes: 3

Related Questions