How to Show Null as Blank in Tableau
Nothing clutters up a polished Tableau dashboard faster than seeing “Null” appear in your tables and charts. It can confuse viewers and make your reports look unfinished. This article will show you several straightforward methods to replace those null values with clean, empty spaces, creating a more professional look for your visualizations.
Why Should You Replace Null Values?
Before diving into the "how," it's worth understanding the "why." Handling nulls isn't just about making things look pretty - though that’s a big part of it. Here are a few key reasons to replace them with blanks:
- Improved Readability: A blank space is often less distracting than the word "Null." It directs your audience's attention to the data that exists, rather than the data that is missing. For tables, it creates much cleaner rows and columns.
- Reduces Confusion: Stakeholders who aren't data-savvy might misinterpret "Null." Does it mean zero? An error? A mistake in the calculation? Replacing it with a blank removes this ambiguity and presents a cleaner, clearer picture.
- Better Dashboard Aesthetics: Your goal is to create a seamless and professional-looking dashboard. Stray text like "Null" scattered throughout grids and visualizations can detract from the overall quality and polish of your work.
Method 1: Using the Format Pane
The quickest way to handle nulls for numeric values (measures) is through the Format pane. This method doesn't change your underlying data or require any formulas. It simply changes how the null values are displayed in a specific view.
This is the best option when you want a quick visual fix and don’t need to use the field in further calculations where the null needs to be handled differently.
Step-by-Step Instructions:
- Find the measure in your view that is displaying null values. This is likely in a table or cross-tab where you can see the text. In the example below, we see "Null" in the "2021" sales column.
- Right-click on that measure from the Marks card or the Rows/Columns shelf.
- From the context menu, select Format.
- The Format pane will open on the left side of your workspace. Make sure you are on the Pane tab at the top.
- Look for the section called Special Values at the bottom. This section controls how things like null values are displayed.
- In the text box for Text, you might see "Null", "Abc", or some other placeholder. Simply delete this text and leave the box completely blank. Press Enter.
Just like that, your nulls will disappear from the view, leaving clean spaces behind. Remember, this is a cosmetic change that only applies to the specific worksheet you're editing. The actual data value is still null in the background.
Method 2: Using Calculated Fields for More Control
While the Format pane is fast, it's not always the perfect solution. Sometimes you need more robust logic, especially when dealing with dimensions (text fields) or when you need to use the outcome in another calculation. This is where calculated fields come in.
Handling Nulls in Dimensions with IFNULL()
The IFNULL() function is one of the most useful tools for this job. It checks if a field is null and, if it is, replaces it with a value you specify. Otherwise, it keeps the original value.
Let's say you have a [Region] field, but some of your sales records weren't assigned a region and are showing up as null.
Create the Calculated Field:
- Click the dropdown arrow at the top of the Data pane and select Create Calculated Field.
- Give your new field a name, like "Region (Cleaned)".
- Enter the following formula:
IFNULL([Region], "")
Let’s break this down:
- IFNULL: This is the function itself.
- [Region]: This is the field we are checking for null values.
- "": These two double quotes with nothing between them represent an empty string, or a blank. This is what will replace any null value found.
- Click OK.
- Now, use this new "Region (Cleaned)" field in your view instead of the original [Region] field. All the places that previously showed "Null" will now be blank.
Using ISNULL() for More Complex Logic
The ISNULL() function works a bit differently. It returns a boolean value: True if the field is null, and False if it isn't. You can use this inside a traditional IF/THEN statement for more complex scenarios.
Using the same [Region] example, the formula would look like this:
IF ISNULL([Region]) THEN "" ELSE [Region] END
This does the exact same thing as the IFNULL() example above, just in a more roundabout way. While IFNULL() is more direct for simple replacements, ISNULL() is incredibly powerful if you have multiple conditions to check.
For example:
IF ISNULL([Region]) THEN "No Region" ELSEIF [Region] = "USA" THEN "United States" ELSE [Region] END
Method 3: Dealing with Null Measures and Zeros
Replacing null measures (numeric fields) can sometimes be tricky because calculated fields must return a consistent data type. You can't have a formula that sometimes returns a number (like Sales) and sometimes a blank string (""). Tableau will give you an error.
The Challenge of Mixed Data Types
If you try to write a calculation like IFNULL([Sales], ""), Tableau will return an error because [Sales] is a number and "" is a string.
The Solution: Convert Everything to a String
To get around this, you must convert the numeric output to a string as well using the STR() function.
Create the Calculated Field:
- Open the calculated field editor.
- Name your new field, for example, "Sales (String)."
- Enter the following formula:
IFNULL(STR([Sales]), "")
Heads up: This approach solves the visual problem but creates a new one. The new "Sales (String)" field is now a text field (a dimension). This means you can't perform any mathematical operations on it, like summing it up or finding an average. It will also sort alphabetically (1, 10, 100, 2, 25) instead of numerically. This solution is best used only for final display in tables where no further math is needed.
A Note on Null vs. Zero
It’s important to understand the difference between a null value and a zero (0) value.
- Null means the data is missing or doesn't exist. There is no value.
- Zero is a specific number. The value is explicitly zero.
Sometimes, a null in your data actually means zero (e.g., a product had zero sales that day). You can use the ZN() function to convert nulls into zeros first.
The formula is simple:
ZN([Sales])
This will create a new measure where every null from the original [Sales] field is now a 0. After doing this, you could use the Format pane trick to hide the zeros if needed by editing the number format.
Bonus Tip: Just Filter Them Out
Sometimes, the best way to handle nulls is to remove them from the view entirely. If the rows or columns containing null values aren't relevant to your analysis, you can simply apply a filter.
- Drag the field that contains nulls onto the Filters card.
- A filter dialog box will appear. You will see a list of available values, including "Null".
- Simply uncheck the box for "Null" and click OK. Or, go to the "Special" tab and select "Non-null values".
This will completely hide any rows or data points where that field has a null value, often cleaning up your visualization in a single click.
Final Thoughts
Cleaning up null values is a fundamental step in making your Tableau dashboards professional, clear, and easy for anyone to understand. Whether you use the quick Format pane for a simple visual tweak or a calculated field like IFNULL() for more control, getting rid of distracting "Null" text will instantly improve the quality of your reports.
We know that juggling data preparation, dashboard design, and constant formatting adjustments can feel like a never-ending task. That incessant drudgery is why we created Graphed. It automates the entire process by allowing you to connect your data sources and create real-time, professional dashboards just by describing what you want to see in plain English. Instead of tinkering with formatting rules and calculated fields, you can get a beautiful, clean report built in seconds.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.