Handling Null Values in Tableau Desktop

Deepak Holla
2 min readDec 18, 2023

--

Typical conversation regarding Handling Null Values in Tableau Desktop

While preparing the data for analysis in Tableau Desktop we might face a situation when we need to work with and handle null values in Tableau.

NOTE 1: There may be many methods to handle null values in Tableau but in this article we are going to restrict it to only few functions.

NOTE 2: We are also restricting the details of this article to only Tableau Desktop and not other data preparation tools (e.g. Tableau Prep Builder, Alteryx etc.) to simplify the explanation.

Given below are the three main Tableau functions that are designed specifically to handle null values:

  1. ZN
  2. IFNULL
  3. ISNULL

ZN:

Syntax: ZN(expression)

Description:
This function returns the expression if it is not null, otherwise it returns zero. We can make use of this function to use zero values instead of null values.

This ZN function is typically used with numeric fields and changes the Null values to 0. This function will return a number data type.

We can prevent errors that are caused by nulls by wrapping the field with ZN.

Using ZN for a particular scenario when both Category and Segment fields are used in a view

IFNULL:

Syntax: IFNULL(expr1, expr2)

Description:
This function returns <expr1> if it is not null, otherwise returns <expr2>. The IFNULL function changes a Null value to something else e.g. 0.

This function works to convert Null dates, text and numbers to something else.

The data type returned by this function depends on the data type of the expression used inside the function.

Using IFNULL for a particular scenario when both Category and Segment fields are used in a view

ISNULL:

Syntax: ISNULL(expression)

Description:
This function returns True if the expression is NULL (i.e. does not contain valid data).

We can use this function to determine if a value is null or is not null.

This function will always return a Boolean data type i.e. either True or False.

Using ISNULL for a particular scenario when both Category and Segment fields are used in a view

I hope this article is useful for all Tableau users especially anyone who is new to Tableau!!!

--

--

Deepak Holla

Recently made a transition into the field of Data Analytics. Have been featured in multiple Tableau DataFam Roundups..