Hi Team, I hope you're doing well. I'm currently u...
# gd-beginners
t
Hi Team, I hope you're doing well. I'm currently using GoodData for reporting purposes, and I've noticed that when I apply the
COUNT
function, it returns a distinct count by default. However, I need to retrieve the total count (i.e., including duplicates/non-distinct values). I haven't been able to find a direct way to achieve this. Could you please advise if there's a function or approach in GoodData that allows for non-distinct counting? Looking forward to your guidance.
m
Hi Tanvi, thank you for this. Could you please provide a bit more of context on how you want to use the 'total count' as KPI? I assume (or not) do you have a primary key, why no just count it? The COUNT as you say, is counting the unique values, so it can be a workaround, but for that we need to understand better the context. Feel free to share a screenshot of the table or attributes if needed (by dm).
m
Hi Tanvi, COUNT({attribute}) in GoodData indeed returns count of distinct values of that attribute. If you want to returnt total number of records in a table/dataset, you can use COUNT((dataset}). If you need to replicate standard SQL behavior of COUNT(something) and therefore exclude NULL values of a specific attribute, you can use something like SELECT COUNT({dataset}) WHERE {attribute} = NULL