I have Googled this and searched the Tableau forums but I'm coming up empty. How can I calculate a distinct count of City Names using Tableau?
Asked
Active
Viewed 4.4k times
2 Answers
4
Is it not:
- Create Calculated Field Analysis->Create Calulatated Field
Name it and enter the below formula
COUNTD([City Name])
Then pull that into your measures?
This should give you your total count. Or am I missing something in your question?

lampbob
- 761
- 1
- 7
- 16
-
Not available on my string field... "Unknown function COUNTD called." – Maus Dec 05 '18 at 13:19
-
Creating a calc Field may not be necessary. In the given view, the countD of city per city will be obviously one. Else for a country --> drag both to rows. Right click city and then --> measure--> Count Distinct. – AnilGoyal Sep 24 '20 at 05:15
0
Another easy way to tackle this problem:
"we need two information as city name and city name (Count Distinct)"
1.To get city name Select [city name] and drag it to row shelf.
2.Again Drag city name into row shelf and Right click on city name in row shelf and Go into measures and select Count Distinct.
Describe in the below link about how to do count Distinct of city name https://i.stack.imgur.com/gpnrj.png

kaz
- 134
- 5