Master Tableau From Scratch

Learn Tableau fundamentals, data connections, data preparation, filtering, data modeling, calculations, LOD expressions, visualizations, dashboards, and storytelling through structured practical lessons.

COURSE SYLLABUS

Handling Missing Values in Tableau

Learn how to identify, understand, and handle missing values in Tableau datasets. Explore NULL values, data-quality checks, filtering techniques, calculated fields, and practical approaches for preparing reliable analytical reports.

1. Introduction to Missing Values

Missing values occur when a field does not contain a usable value for a particular record. In Tableau, missing information may appear as NULL values, blank fields, or incomplete records.

Missing data can affect calculations, visualizations, aggregations, filters, and business decisions. Therefore, it is important to identify missing values before building reports and dashboards.

Example

Consider a sales dataset containing Customer Name, Region, Sales, and Profit. Some records may have a missing Region or Profit value.

If these records are not reviewed properly, regional sales analysis or profit calculations may produce incomplete or misleading results.

Important: Missing values should not automatically be replaced with zero. First understand why the value is missing and whether a replacement is appropriate for the business requirement.

2. Understanding Missing Values in a Dataset

A dataset may contain complete records as well as records with missing fields. The following example illustrates how missing values can appear in a sales dataset.

Sample Sales Dataset

Order ID Customer Region Sales Profit
1001 Rahul East 1200 250
1002 Priya West 1800 350
1003 Amit NULL 900 100
1004 Neha South 1500 NULL
1005 Vikas NULL NULL 200

In this dataset, some records do not contain Region, Sales, or Profit values. These missing values need to be investigated before using the dataset for business analysis.

Missing Values in a Dataset Order ID Region Sales Profit 1001 East 1200 250 1002 West 1800 350 1003 NULL 900 100 1004 South 1500 NULL 1005 NULL NULL 200

Highlighted cells represent missing values in the sample dataset.

3. Types of Missing Data

Understanding why data is missing helps determine the appropriate cleaning method. In data analysis, missingness is commonly described using three categories.

1. Missing Completely at Random (MCAR)

Values are missing for reasons unrelated to the observed or unobserved data.

Example: A temporary system failure causes some records to be omitted randomly.

2. Missing at Random (MAR)

Missingness is related to other observed variables in the dataset.

Example: Certain customer records have missing information because of the data collection process used for a particular customer group.

3. Missing Not at Random (MNAR)

Missingness is related to the value that is missing or to an unobserved factor.

Example: Customers with very low income may be less likely to disclose their income information.

Note: These categories describe the underlying reason for missingness. Tableau can help identify and handle missing values, but determining the actual reason generally requires business context and source-system investigation.

4. How to Identify NULL Values in Tableau

Tableau provides several ways to identify missing values. You can inspect the Data Source page, use filters, review visualizations, or create calculated fields to identify records where a field is NULL.

Method 1: Inspect the Data Source Page

  1. Connect Tableau to your dataset.
  2. Open the Data Source page.
  3. Select the required table or sheet.
  4. Review the Data Preview Grid.
  5. Look for NULL or blank values in the fields.

Method 2: Use a Filter

  1. Open a worksheet.
  2. Drag the field you want to inspect to the Filters shelf.
  3. Review the available values.
  4. Select the Null option if it is available.
  5. Apply the filter to display records with missing values.

Method 3: Use a Calculated Field

You can create a calculated field using the ISNULL() function to identify missing values.

Example: Check Missing Region

IF ISNULL([Region]) THEN
    "Missing Region"
ELSE
    "Available"
END

This calculation returns Missing Region when the Region field contains a NULL value. Otherwise, it returns Available.

Tip: Create a separate worksheet showing missing-value counts for important fields. This makes data-quality checks easier to review.

5. Visualizing Missing Values

A simple visualization can help identify how many records contain missing values. You can use a calculated field to classify records as Missing or Available and then display the results in a chart.

Data Quality Overview Region Sales Profit Available Missing Illustrative field completeness Available Values Missing Values

Conceptual data-quality chart showing available and missing values.

The chart above is illustrative. In a real Tableau worksheet, the counts should be calculated from your actual dataset rather than entered as fixed values.

6. Filtering NULL Values

Filters can be used to include or exclude records with missing values. This is useful when you want to analyze only complete records or investigate incomplete records separately.

Filter Out NULL Values

  1. Open a worksheet.
  2. Drag the required field to the Filters shelf.
  3. Locate the Null option in the filter values.
  4. Exclude Null when the analysis requires complete records.
  5. Apply the filter and validate the resulting data.

Display Only NULL Values

  1. Drag the field to the Filters shelf.
  2. Select the Null value.
  3. Apply the filter.
  4. Review the records that contain missing values.
Important: Excluding NULL values changes which records appear in the analysis. It does not repair the underlying source data. Always confirm that excluding those records is appropriate for the reporting requirement.

7. Handling NULL Values Using Calculated Fields

Tableau provides functions that help work with NULL values in calculated fields. Two commonly used functions are IFNULL() and ZN().

IFNULL() Function

IFNULL() checks whether an expression is NULL. If it is NULL, Tableau returns the alternative value supplied in the calculation.

Syntax

IFNULL(expression, replacement_value)

Example

IFNULL([Profit], 0)

If Profit is NULL, the calculation returns 0. Otherwise, it returns the original Profit value.

ZN() Function

ZN() returns zero when the supplied numeric expression is NULL. When the expression contains a non-NULL numeric value, it returns that value.

Example

ZN([Sales])

If Sales is NULL, the calculation returns 0. Otherwise, it returns the existing Sales value.

Function Purpose Example
ISNULL() Checks whether an expression is NULL. ISNULL([Sales])
IFNULL() Replaces a NULL expression with an alternative value. IFNULL([Profit], 0)
ZN() Returns zero for a NULL numeric expression. ZN([Sales])
Important: Use IFNULL() and ZN() only when zero is a meaningful replacement for the analysis. A missing value does not always mean that the actual value was zero.

8. Replacing Missing Values with Appropriate Values

In some business scenarios, missing values can be replaced with a suitable default or calculated value. The replacement method depends on the field type and the meaning of the data.

Field Type Possible Handling Method Example
Numeric Use zero or a calculated value when justified. IFNULL([Sales], 0)
String Use a meaningful category label. IFNULL([Region], "Unknown")
Date Investigate the source or use an approved default date. IFNULL([Order Date], #2026-01-01#)
Boolean Use a default only when business rules define it. IFNULL([Is Active], FALSE)

Example: Replace Missing Region

IFNULL([Region], "Unknown")

This calculated field displays Unknown when Region is NULL. Existing region values remain unchanged.

Example: Replace Missing Profit

IFNULL([Profit], 0)

This calculation replaces missing Profit values with zero. Use it only when the business definition supports this treatment.

9. Handling Missing Date Values

Missing dates can affect time-based analysis, trend charts, date filters, and period comparisons. A record without a valid date may not appear in a date-based visualization as expected.

Example: Order Date

Order ID Order Date Sales
1001 2026-01-10 1200
1002 2026-01-15 1500
1003 NULL 900

Recommended Approach

  1. Identify records with missing dates.
  2. Check the original source system for the correct date.
  3. Determine whether the date is required for the analysis.
  4. Keep records separate if the correct date cannot be established.
  5. Document any approved replacement or exclusion rule.
Best Practice: Do not assign an arbitrary date simply to make a chart display every record. An incorrect date can distort monthly, quarterly, and yearly analysis.

10. NULL Values, Zero, and Blank Values

NULL, zero, and blank values are not necessarily the same. Understanding the difference is essential when preparing datasets for analysis.

Value Meaning Example
NULL No value is available or recorded. Profit = NULL
Zero A numeric value equal to zero. Profit = 0
Blank String A text field containing an empty string. Customer Name = ""
Whitespace A text value containing spaces. Region = " "
Remember: A blank string or whitespace may not behave like a NULL value. If your source contains empty text values, inspect and clean them separately.

11. Complete Missing-Value Handling Workflow

1. Inspect the Dataset 2. Identify Missing Values 3. Investigate the Reason 4. Select a Handling Method 5. Validate the Results 6. Document the Changes

Recommended process for identifying, handling, and validating missing values.

Step-by-Step Process

  1. Connect Tableau to the required dataset.
  2. Inspect the Data Source page.
  3. Identify fields containing NULL or blank values.
  4. Investigate why those values are missing.
  5. Choose whether to retain, filter, replace, or correct the records.
  6. Create calculated fields when appropriate.
  7. Validate totals and record counts after applying changes.
  8. Document the data-cleaning decisions.

12. Common Mistakes and Troubleshooting

1. Replacing Every NULL with Zero

Zero may not represent the actual missing value. Investigate the business meaning before replacing numeric NULL values.

2. Removing All Records with NULL Values

Filtering out every incomplete record may remove important business information. Review the impact before excluding records.

3. Confusing Blank Strings with NULL

Empty strings and whitespace values may need separate text-cleaning logic. Do not assume every blank-looking value is NULL.

4. Incorrect Calculated Field

Verify the field data type and calculation syntax. Make sure the replacement value is compatible with the original expression.

5. Incorrect Aggregation After Cleaning

Recheck SUM, AVG, COUNT, and other calculations after replacing or filtering missing values. Cleaning can change the resulting totals and averages.

6. Ignoring the Source System

Tableau calculations can help handle missing values in analysis, but they do not necessarily repair the original source records. Correct source data when possible and appropriate.

13. Best Practices

  • Inspect important fields before creating reports.
  • Distinguish NULL values from zero and blank strings.
  • Understand why values are missing before selecting a solution.
  • Use ISNULL() to identify missing values in calculations.
  • Use IFNULL() and ZN() only when the replacement is meaningful.
  • Validate record counts and numerical totals after cleaning.
  • Keep a record of filtering and replacement decisions.
  • Review the impact of missing values on business KPIs.
Industry Tip: Data cleaning should be repeatable and documented. A reliable reporting process makes it possible for other developers and analysts to understand how the final numbers were produced.

14. Practical Exercise

Exercise: Clean Missing Values in a Sales Dataset

Connect Tableau to a sales dataset containing Order ID, Region, Sales, Profit, and Order Date.

  1. Inspect the dataset in the Data Source page.
  2. Identify NULL values in Region, Sales, Profit, and Order Date.
  3. Create a calculated field to identify missing Region values.
  4. Create another calculated field using ISNULL([Profit]).
  5. Use IFNULL() to create a replacement Profit field for an appropriate scenario.
  6. Filter the records containing missing dates.
  7. Compare the total Sales before and after applying filters.
  8. Validate the number of records included in the final analysis.
  9. Document the cleaning decisions.

15. Practice and Interview Questions

Q1. What are missing values in Tableau?

Missing values are fields or records that do not contain an available value, often represented by NULL.

Q2. What is a NULL value?

NULL represents the absence of a value. It is different from numeric zero and an empty text string.

Q3. How can you identify NULL values in Tableau?

You can inspect the Data Source page, use filters, create calculated fields with ISNULL(), or build visualizations that classify missing records.

Q4. What is the use of ISNULL()?

ISNULL() checks whether an expression contains a NULL value and returns a Boolean result.

Q5. What is the difference between IFNULL() and ZN()?

IFNULL() replaces a NULL expression with a specified alternative value. ZN() returns zero for a NULL numeric expression.

Q6. Should every NULL value be replaced with zero?

No. Zero should be used only when it correctly represents the business meaning of the missing value.

Q7. What happens when NULL values are excluded using filters?

Records matching the NULL condition are excluded from the filtered view. This can affect totals, averages, and other calculations.

Q8. What is the difference between NULL and an empty string?

NULL represents an absent value, whereas an empty string is a text value containing no characters.

16. Summary

Missing values are an important data-quality issue in Tableau. They can affect calculations, aggregations, filters, and visualizations. Identifying missing values early helps analysts understand the quality and completeness of their datasets.

Tableau provides useful techniques for working with missing values, including filters and calculated fields. Functions such as ISNULL(), IFNULL(), and ZN() help identify and handle NULL values based on analytical requirements.

A reliable data preparation process requires understanding why values are missing, choosing an appropriate handling method, validating the results, and documenting the changes. This helps ensure that Tableau reports and dashboards provide meaningful and trustworthy business insights.