I have a table that lists States and Cities. I need a measure that counts how many distinct cities exist for each state.
As an example. Say there are 500 cities in CA and 10 Cities in NV. My result should look like
Los Angeles 500
San Diego 500
Las Vegas 10
Reno 10
Obviously if I wanted the results for each state I could do a simple distinctcount and be done with it. However since my results are for each city that's where I'm having some problems.
I tried the following with no success
StateID:=values(Table1[State])
Measure2 = CALCULATE(DISTINCTCOUNT(Table1[City]),filter(all(table1),Table1[State]=[StateID]))
If you can somehow get this working the second part is to add additional filters, so do a count of the cities but only those cities with populations over x.
Any help is greatly appreciated. Thanks!
As an example. Say there are 500 cities in CA and 10 Cities in NV. My result should look like
Los Angeles 500
San Diego 500
Las Vegas 10
Reno 10
Obviously if I wanted the results for each state I could do a simple distinctcount and be done with it. However since my results are for each city that's where I'm having some problems.
I tried the following with no success
StateID:=values(Table1[State])
Measure2 = CALCULATE(DISTINCTCOUNT(Table1[City]),filter(all(table1),Table1[State]=[StateID]))
If you can somehow get this working the second part is to add additional filters, so do a count of the cities but only those cities with populations over x.
Any help is greatly appreciated. Thanks!