Tableau ISNULL function

The Tableau ISNULL is one of the logical functions that will check whether the given expression is NULL or not. If the expression is NULL, it will return True; Otherwise, it will return False. If you combine this ISNULL function with another logical function, NOT, the result will be exactly the opposite. 

This Tableau article will show you how to use the ISNULL and NOT functions with an example. The syntax of the ISNULL function is as shown below.

ISNULL(Expression)

The syntax of the NOT function is as shown below.

NOT(Expression)

The syntax of the Tableau NOT ISNULL function is as shown below.

NOT ISNULL(Expression)

For instance, Expression = NULL, and the result is.

  • ISNULL(Expression) = TRUE
  • NOT ISNULL(Expression) = FALSE

Similarly, Expression = 10 (or any positive or negative integer value), and the result is.

  1. ISNULL(Expression) = FALSE
  2. NOT ISNULL(Expression) = TRUE

Tableau NOT ISNULL Function Examples

To demonstrate this Tableau NOT ISNULL logical function, we will use the numerical and string columns in the Employee table. First, we must create a calculated Field to use this built-in NOT ISNULL function because we have to write an expression.

To do this, right-click the empty space within the Measures shelf to select the Create Calculated Field.. option. Please visit the SQL Source, calculated field, and SQL Tutorial article to understand the Data Source.

Simple Employee table

In the first example, we will use the Tableau ISNULL function to check whether there are null values in the Sales column. 

ISNULL(Sales)
Create a calculated field to write the expression

Next, let me add that Review calculated field to the table Rows shelf. If you look at the output, you can see the True for the NULL values and False for not null values. Please refer to NULL functions and for all the built-in functions in Tableau >> Click Here!

Tableau ISNULL Function Boolean result

Let me Edit the existing Review calculated field using the down arrow and replace the Sales measure with Yearly Income. It will check whether there are null values in the Yearly Income column. 

ISNULL([Yearly Income])

You see the changes in the above image as we hit the apply button.

Tableau ISNULL Function on measure values boolean result

We use the Tableau IIF function and Logical OR to check multiple ISNULL conditions this time. The below expression returns Bad if either Yearly Income or Sales values are NULLs; Otherwise, it returns Good.

IIF(ISNULL([Yearly Income]) OR ISNULL(Sales),'Bad', 'Good')
Tableau ISNULL Function and IIF condition result

Similarly, you can experiment with the AND operator. This expression returns Bad if both Yearly Income and Sales values are NULLs. Otherwise, it returns Good.

IIF(ISNULL([Yearly Income]) AND ISNULL(Sales), 'Bad', 'Good')

NOT ISNULL Examples

As we said earlier, joining the NOT keyword before the Tableau ISNULL function will return the exact opposite results. For instance, the below expression checks for NULLS inside the Sales column, and because there is NOT a keyword, it returns True if it is not a null value. And for NULL values, it returns False.

NOT ISNULL(Sales)
NOT ISNULL Exampe

Let me check this logical function on the dimension column, i.e., Education.

NOT ISNULL([Education])
Tableau NOT ISNULL Function on dimension string column

With the help of the IF ELSE statement and logical AND operator, we can test multiple conditions. The below statement returns Good if all three columns (Education, Occupation, and Name) are not null. Otherwise, it returns BAD.

IF(NOT ISNULL([Education]) AND NOT ISNULL([Occupation])
AND NOT ISNULL([Name]))
THEN 'Good'
ELSE 'BAD'
END
Tableau NOT ISNULL Function and IF Else condition result

Similarly, use the Tableau NOT ISNULL function expression below to test the numerical measure columns.

IF(NOT ISNULL([Education]) AND NOT ISNULL([Occupation])
OR NOT ISNULL([Sales]) OR NOT ISNULL([Yearly Income]))
THEN 'Good'
ELSE 'BAD'
END