How to Show 0 Instead of Blank in Tableau

Cody Schneider7 min read

Seeing blank spaces pop up in a Tableau visualization when you're expecting a neat column of zeros can be frustrating. You know the data should reflect a zero, not an empty void, but getting Tableau to agree can feel like a puzzle. This article will walk you through several methods to replace those blanks with zeros, from a quick formatting trick to a robust calculation that handles even the trickiest data structures.

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

Why Does Tableau Show Blanks in the First Place?

Before we fix the problem, it helps to understand why it happens. In Tableau's world, there's a big difference between a value of zero and a null value (a blank space). A zero is an actual numerical value, while a blank typically means there is no data for that specific combination of dimensions. It's not that the value is zero, it’s that the row doesn’t even exist in your source data.

Imagine you have weekly sales data for three products: Alpha, Bravo, and Charlie.

  • Week 1: Product Alpha sells 100 units.
  • Week 1: Product Bravo sells 50 units.
  • Week 2: Product Alpha sells 75 units.
  • Week 2: Product Charlie sells 120 units.

If you create a table in Tableau with 'Week' and 'Product' on the rows and 'Sales' on the text mark, you'll see blanks for Product Charlie in Week 1 and for Product Bravo in Week 2. This is because your dataset has no entry for "Week 1, Product Charlie." Tableau is accurately showing that it has no data to display.

Our goal is to tell Tableau how to handle these missing data points. Here are a few ways to do it, ordered from simplest to most powerful.

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 Quick Format Fix

If you just need a cosmetic fix for a table and don't plan to use the values in further calculations, the fastest way to replace blanks is with formatting. This method doesn't change the underlying data - it just changes how the blanks are displayed.

This is great for presentation-ready tables and dashboards where you just want to get rid of the empty space visually.

How to Do It:

  1. Right-click on the measure pill in your view (the one showing the blanks, for example, SUM(Sales)) and select Format.
  2. The Format pane will open on the left-hand side. Make sure you're on the Pane tab.
  3. Look for a section at the bottom called Special Values.
  4. In the text box labeled Text:, you can type whatever you want to show up in place of a blank. For our purpose, simply type a "0".
  5. Click away, and you'll see all your blanks have been replaced with zeros in the view.

Pros:

  • Extremely fast and easy to implement.
  • Doesn't require writing any code or calculated fields.

Cons:

  • This is purely a visual fix. The underlying data value is still null.
  • If you try to use this field in another calculation (e.g., Year over Year Growth), it will behave like a null, which might break your formula or give you unexpected results.

Method 2: Using the ZN() Function

The ZN() function is one of the most useful and straightforward tools in your Tableau toolkit. The name stands for "Zero Null," and it does exactly that: it checks an expression, and if the result is null, it converts it to zero. If the result is not null, it keeps the original value.

This method actually changes the data value, turning nulls into a numerical zero that can be used correctly in other calculations.

How to Do It:

  1. In the Data pane, right-click and select Create Calculated Field.
  2. Give your new field a descriptive name, like "Sales (with Zeros)."
  3. In the formula box, type the following:
  4. Click OK.
  5. Now, drag your original measure (e.g., SUM(Sales)) off the view and replace it with your new calculated field, "Sales (with Zeros)."

For some views, your blanks will instantly be replaced by genuine zeros.

Pros:

  • Converts the null value into an actual zero, which can be safely used in further calculations.
  • The logic is simple and easy to understand.

Cons:

  • This only works if a null value exists to be converted. It won't work in the "sparse data" scenario we described earlier, where the entire row of data is missing. If there's no row, SUM([Sales]) doesn't return null - it returns nothing. And ZN() can't convert nothing into something.
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

Method 3: The Flexible IFNULL() Function

The IFNULL() function is a slightly more versatile cousin of ZN(). It checks if a value is null and allows you to replace it with a second value that you specify.

The syntax is IFNULL(expression1, expression2). If expression1 is not null, the function returns it. If expression1 is null, the function returns expression2.

How to Do It:

  1. Create a new calculated field.
  2. Name it something like "Sales (IFNULL)."
  3. In the formula box, type:
  4. Click OK and replace the old measure in your view with this new one.

For replacing nulls with zero, IFNULL(SUM([Measure]), 0) and ZN(SUM([Measure])) are functionally the same. The primary advantage of IFNULL() is its flexibility if you ever need to replace a null with something other than zero, like -1, or even text if your data types match.

Pros & Cons:

It solves for null values but doesn't solve for missing rows of data. It addresses the symptom, not the root cause of sparse data.

Method 4: The Ultimate Solution: ZN() with LOOKUP()

When you have sparse data and rows are completely missing, you need a way to force Tableau to "fill in the blanks" so there's a null value waiting there for you to convert. The trick is to use a table calculation, which triggers a powerful feature in Tableau called "data densification." Data densification essentially builds out the grid and creates empty cells for all combinations of your dimensions.

The simplest table calculation to use for this is LOOKUP().

How to Do It:

  1. Create a new calculated field. Name it something that makes sense, like "Sales (Densified)."
  2. In the formula box, enter the following:
  3. Let's break this down:
  4. Drag this new calculated field onto your view to replace the old measure pill. Voilà! Your blanks should now be zeros, even where no data rows existed before.

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.

An Important Extra Step: Show Empty Rows/Columns

Sometimes, for data densification to work properly, you need to tell Tableau explicitly to show those empty spots. If your ZN(LOOKUP(...)) calculation doesn't seem to work, try this:

  • Navigate to the top menu and click Analysis > Table Layout.
  • From there, select either Show Empty Rows or Show Empty Columns, depending on the structure of your view.

This setting, combined with a table calculation, is the most reliable way to force Tableau to display all possible dimension combinations and fill them with zeros.

Pros:

  • This is the most robust and reliable method for almost all situations.
  • It solves the core problem of sparse data by forcing Tableau to create marks for missing data points.

Cons:

  • Table calculations can sometimes add a layer of complexity (e.g., you may need to adjust the "Compute Using" settings), although for this specific use case, it often works out of the box.

Which Method Is Right for You?

Not sure which approach to take? Here's a quick guide:

  • Want a quick visual fix and nothing else? Use Method 1: Formatting. It's the fastest way to get numbers on the screen.
  • Does your data source contain genuine nulls? (i.e., the rows exist, but the measure value is empty) Use Method 2: ZN() or Method 3: IFNULL().
  • Is your table or chart missing combinations? (i.e., complete rows of data are absent) Use Method 4: ZN(LOOKUP()). This is your go-to solution for virtually any situation involving blanks.

Final Thoughts

Learning how to handle null and missing data is a fundamental step in mastering Tableau. By understanding the difference between a zero and a blank, you can choose the right method - whether it’s a quick formatting trick or a powerful table calculation - to make your visualizations clear, accurate, and professional.

While mastering these functions is a great skill, sometimes you just need to get answers from your data without wrestling with calculated fields. We built Graphed for exactly that reason. Instead of figuring out the right Tableau function, you can just ask in plain English, "Show me my sales by product for each week last quarter," and get an interactive dashboard instantly. It automates away the technical busywork so you can focus on the insights.

Related Articles