简体   繁体   中英

How to get COUNT value of unique ID's only ONCE in Tableau

I have a data set where the rows have an ID column, sometimes there are duplicates of the IDs which is causing an inflated number when applying a COUNT() calculation. I need to only count unique items in this list but COUNTD() does not work.

When trying to use COUNTD() it gives this error: cannot blend secondary data source because one or more fields use an unsupported aggregation when hovering over the Measures because it is now red.

I've tried using COUNTD()

ID First  Last
1  Jim    Carrey
1  Jim    Carrey
2  Liam   Neeson
3  Wynona Ryder


COUNT([ID]) = 4
COUNTD([ID]) results in error

COUNTD seems to be the only calc function that identifies unique items but it is not returning anything

I would make sure that ID is type string (next to the variable, make sure it has 'abc' next to it instead of #) and retry your function... Tableau could be confused about trying to get a count distinct of a numerical value.

You could also potentially try COUNTD(STR([ID])).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM