How to Remove Null Values in Tableau

Cody Schneider••9 min read

Nothing brings a dashboard-building session to a halt quite like discovering null values scattered throughout your data. These empty spots can break your charts, skew your calculations, and make your reports look unprofessional. This guide will walk you through several practical methods to handle null values directly in Tableau, from simple filtering to more advanced options that give you full control over your visualizations.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What Are Null Values and Why Do They Matter?

First, let's be clear about what a null value is. It’s not a zero, and it’s not an empty space or a blank string (""). A null value represents the absence of data. It means that for a particular record, no value was entered or exists. This could happen for countless reasons: a customer didn't provide their phone number, a sales record is missing a shipping date, or there was simply no activity to record for that period.

These nulls become a problem in data analysis because they behave unpredictably. If you're calculating an average, Tableau will simply ignore the nulls rather than treating them as zero, which can dramatically inflate your average. For instance, if you have sales figures of 100, 200, and a null, the average would be (100+200)/2 = 150. If that null was intended to be a 0, the real average should be (100+200+0)/3 = 100. Furthermore, nulls can create unsightly gaps in line charts or unexpected blank spaces in your tables, confusing anyone trying to interpret your dashboard.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Method 1: The Quickest Fix - Filtering Out Nulls

The simplest and most direct way to deal with nulls is to remove them from your view entirely. This technique is perfect when the rows containing nulls are irrelevant to your analysis and you're happy to discard them completely from a specific worksheet.

When to use this method: You want to analyze only the data that is complete for a specific field. For example, if you're analyzing customer feedback scores and only want to see data from customers who actually left a score.

Step-by-Step Instructions:

  1. Drag the pill (the colored field item) that contains the null values from your Data pane onto the Filters card.
  2. A filter dialog box will pop up. In the "General" tab, you'll see a list of all potential values in that field. At the bottom of this list, there is often a "Null" checkbox. Simply uncheck this box to exclude rows where this field is null.
  3. Alternatively, you can navigate to the "Special" tab at the top of the dialog box. Here, you'll see two radio buttons: "All values" and "Non-null values." Select Non-null values.
  4. Click OK. Tableau will now exclude any row where your selected field has a null value from the visualization on that worksheet.

Keep in mind: This is a powerful but blunt instrument. Filtering out a row based on a null in one column removes the entire row from your sheet. If that row contains valuable information in other columns you need for your analysis, this method may not be suitable, and you should consider one of the replacement methods below.

Method 2: Replacing Nulls with Another Value

Sometimes you need to keep the row of data but replace the null with a sensible value, like a zero for numerical data or "Unknown" for text data. This is where Tableau's calculated fields shine, giving you precise control. We'll look at the most common functions for this.

Using the ZN() Function for Numbers

The ZN() function literally stands for "Zero Null." It looks at a measure and if it finds a null value, it converts it to a zero. If the value is not null, it leaves it as is.

When to use this method: You're working with a numeric field (like sales, units sold, or profit) where a missing value should be interpreted as zero.

How to Create a ZN Calculated Field:

  1. In the Data pane on the left, click the small dropdown arrow at the top and select "Create Calculated Field."
  2. Give your new field a descriptive name, like "Sales (No Nulls)."
  3. In the formula box, type the following:
ZN([Your Measure Name Here])

For example, if your sales field is called just [Sales], the formula would be ZN([Sales]).

  1. Click OK. You'll now see your new calculated field in the Data pane.

Now, instead of using the original [Sales] field in your charts and tables, use your newly created "Sales (No Nulls)" field. All the nulls will now appear as zeros, ensuring your calculations are accurate and your visualizations are complete.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Using IFNULL() for Greater Flexibility

The ZN() function is great, but it has two limitations: it only works on numbers, and it can only replace nulls with zero. If you need to replace nulls in a text field or want to substitute numbers with something other than zero, the IFNULL() function is your best friend.

When to use this method: You need to replace a null in a text field (e.g., replacing a missing region with "Not Specified") or replace a numeric null with a value other than zero.

How the IFNULL() Function Works:

The syntax for this function is straightforward:

IFNULL([Your Field], 'Value to use if null')

The function checks the first part [Your Field]. If it's not null, it returns the original value. If it is null, it returns the second part, which is the replacement value you specified.

Examples:

  • For a text field: Imagine you have a [Customer Segment] field with some nulls. To replace them, you could create a calculated field named "Customer Segment (Cleaned)" with this formula:
IFNULL([Customer Segment], "Unassigned")
  • For a numeric field: Suppose a null in your [Discount] field actually means a 10% default discount should apply. You can create a calculated field named "Discount (Adjusted)":
IFNULL([Discount], 0.10)

You can even nest these functions. For example, if you want only zeros but your field contains empty strings "" that are causing issues: ZN(INT([Your Field]))

Method 3: Formatting to Hide Null Indicators

What if you want to keep the null values in your dataset for calculations but simply want to hide the ugly "Null" text label or fix gaps in a line chart? In these scenarios, you don't need a calculation at all - you just need to adjust Tableau's formatting.

When to use this method: You're building a text table (crosstab) and want to display a blank or a dash instead of the word "Null," or you have a line chart with gaps you want to connect.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Formatting Nulls in a Table

  1. Build your text table as you normally would.
  2. Right-click on the measure pill in your view (the one showing numbers with some nulls) and select Format...
  3. The Format pane will open on the left. Make sure you are on the "Pane" tab.
  4. At the bottom of this tab, you will see a section called "Special Values." Here, you can define what to show for null values in the "Text" field. You can leave it blank to show nothing, or type a hyphen (-) or "N/A."
  5. As soon as you enter text, the view updates automatically.

Connecting Gaps in a Line Chart

If you have nulls in the time series data for a line chart, Tableau will create gaps by default. Sometimes this is desirable to show missing data, but other times you want a continuous line.

  1. With your line chart built, right-click the measure pill on the Rows or Columns shelf and select Format...
  2. In the Format pane on the left, stay on the "Pane" tab.
  3. Go down to the "Special Values" section again. Look for a dropdown menu under "Marks."
  4. Here, you can choose how to handle breaks in the line. Your main options are:

Choosing "Connect Lines" is a common way to clean up a chart's appearance, but be cautious. It can imply a trend that doesn't exist in the data, so make sure it's appropriate for your analysis and transparent to your audience.

Which Method Is Right for You? A Quick Guide

With several options available, it's easy to get confused. Here's a quick summary to help you choose the best approach for your situation:

  • To completely remove rows with missing data: Use the Filter card. Best when the rows with nulls contain no other useful information for that specific analysis.
  • To replace missing numbers with zero: Create a calculated field with the ZN() function. This is the standard for numerical data where a null means "none".
  • To replace any null (text or number) with a specific value: Create a calculated field with the IFNULL() function. This offers the most control and customization.
  • To hide null text labels in a table without changing underlying data: Use the Format > Special Values menu. Ideal for presentation and aesthetics.
  • To bridge gaps created by nulls in a line chart: Use the Format > Special Values > Marks menu. Great for visual continuity, but use it with care.

Final Thoughts

Handling null values is a fundamental part of preparing your data for analysis in Tableau. Whether you choose to filter them out, replace them with a calculated field using ZN() or IFNULL(), or simply format your chart to hide them, you now have a comprehensive toolkit to clean up your data and build more accurate, professional, and reliable dashboards.

Manually cleaning data source by source and wrangling calculations in Tableau, though powerful, adds up to a lot of time spent on prep work instead of analysis. At Graphed, we connect directly to your data sources - like Google Analytics, Salesforce, and Shopify - and let you use plain English to build real-time reports. Our AI-driven platform handles the data prep behind the scenes, so you can just ask questions and get clean visualizations back in seconds.

Related Articles