KNOWLEDGE BASE

Calculated Field Returns Null Results


Published: 31 Jul 2014
Last Modified Date: 13 Nov 2023

Issue

Calculated fields return NULL or blank values instead of expected results

Environment

Tableau Desktop 

Resolution

CLICK TO EXPAND SOLUTION
Scenario 1: Expressions containing a field with a NULL value may return NULL values
CLICK TO EXPAND SOLUTION
Scenario 2: Conditions containing a NULL value will return NULL values
CLICK TO EXPAND SOLUTION
Scenario 3: CASE or IF statements without ELSE statements will return NULL values when no conditions are True
CLICK TO EXPAND SOLUTION
Scenario 4: Expressions including multiple mutually exclusive CASE or IF statements may return NULL values
CLICK TO EXPAND SOLUTION
Scenario 5: Converting a non-numeric string into a number
CLICK TO EXPAND SOLUTION
Scenario 6: Expressions dividing by zero will return NULL
CLICK TO EXPAND SOLUTION
Scenario 7: DATE() or DATEPARSE() may return NULL

Cause

  • For scenarios 1, 2 & 4, any calculation that includes NULL will return NULL because NULL values are not numeric values and thus require special handling.
  • For scenario 3, Tableau adds ELSE NULL to any logical calculation that does not have an ELSE statement. This means if all conditions are False, then NULL will be returned.
  • For scenario 5, any number divided by zero is mathematically undefined. For consistency, Tableau displays the value as a NULL. For more information, see this Wikipedia article Division by zero
Did this article resolve the issue?