5
votes

I am relatively new to Tableau and I am wondering if there is a way to calculate null values in a column. I have a column called Email of type string and want to know how many people have not entered their email i.e. Null.

I tried to create a calculated field with count(ISNULL([Email]))

But this gives me the total count and not the count of null.

Thanks.

4

4 Answers

12
votes

You cannot count NULL since COUNT ignores NULLs.

You can do this, though:

SUM(IF ISNULL([Email]) THEN 1 ELSE 0 END)


Per your additional comment, if you wanted to count where two fields are both NULL then:

SUM(IF ISNULL([Email]) AND ISNULL([Phone]) THEN 1 ELSE 0 END)

You can continue this for any number of fields, as needed.

2
votes

You can use a filter for that field. Set it to only show you Null values, and set the measure to Count instead of the default Sum.

filter dialog

0
votes

You can create another column where all null values are set to 1 and anything else to 0, >then count that. It should be something like

>COUNT(IF "null" THEN 1 ELSE 0)

A working syntax for that would had been:

SUM(IF ([Your field] = null) THEN 1 ELSE 0 END)

-2
votes

You can create another column where all null values are set to 1 and anything else to 0, then count that. It should be something like

COUNT(IF "null" THEN 1 ELSE 0)