Reputation: 3599
I created a tableau view that gives no. of students in each school.
My input dataset is below. Intentionally I kept null student_name .
As you can see 3rd row and 4th row are having null names
student_name school
Stev Boston Academy
Mike Florida school
Boston Academy
Boston Academy
Sue Florida school
Jim Florida school
But here nulls are automatically skipped .
Even if I apply quick filter to include nulls then also nulls are skipped .
As you can see there are 2 null names for Boston Academy.. I am expecting count as 3 for Boston academy.
Below is the view
I would like know how tableau behaves if we have null for student_name.
Does it skip null? Does it skip null even if we apply filter to include null?
Upvotes: 1
Views: 132
Reputation: 11896
Count() by definition ignores nulls like the other aggregation functions. More precisely, CNT([Student Name]) returns the number of records with a non-null value for the field [Student Name]).
That is standard database behavior.
If you want to count the number of data rows per school, regardless of whether [Student Name] has a value, then you can use CNT(1) (the 1 could be any non-null constant value), or possibly slightly less efficiently SUM(1) or equivalently SUM([Number of Records])
Upvotes: 1