简体   繁体   中英

Why Nulls are automatically skipped in Tableau

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?

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])

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