Does Not Equal in Tableau Calculated Field

Cody Schneider8 min read

Trying to exclude specific data from your Tableau visualization can feel like it should be simple, and it is once you know the right operator. Tableau’s “does not equal” operators are essential for creating flexible and focused calculated fields. This guide will walk you through exactly how to use “does not equal” in your calculations to filter out data you don’t want and zero in on the insights you need.

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 the "Does Not Equal" Operators in Tableau?

In Tableau, you have two operators to signify "does not equal" in a calculated field:

  • &lt,&gt, : This is the most common operator for "does not equal" and is borrowed from standard SQL (Structured Query Language).
  • != : This operator serves the exact same purpose and is common in other programming languages like C++, Java, and Python.

Both operators are functionally identical in Tableau, so which one you use is purely a matter of preference. However, many data professionals prefer sticking with &lt,&gt, because of its roots in SQL, the language of databases. It’s often considered a best practice because it makes your calculations more familiar to anyone with a background in data analysis or business intelligence. Regardless of which you choose, the logic remains the same: it helps you test if two values are not identical.

How to Use "Does Not Equal" in a Calculated Field (Step-by-Step)

The most common way to use a “does not equal” operator is within an IF statement. This allows you to create conditional logic - if a certain condition isn’t met, you can tell Tableau to do something else, like return a different value or perform another calculation.

Let's walk through a practical example. Imagine you're working with the classic Superstore dataset and you want to analyze profit, but you need to exclude the 'Technology' category to see how your other product categories are performing on their own.

Step 1: Create a New Calculated Field

First, open the sheet where you want to perform this analysis. In the Data pane on the left, right-click anywhere and select Create Calculated Field…. This will open the calculation editor.

Give your new field a clear, descriptive name. Something like "Profit (Excluding Technology)" is perfect because it immediately tells anyone using the workbook what the calculation does.

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.

Step 2: Write the Formula

Now, type the following formula into the editor. This formula checks the category for each row of data. If the category is not 'Technology', it returns the profit for that row. If it is 'Technology', it returns a value of 0, effectively removing it from your aggregation.

IF [Category] &lt,&gt, 'Technology'
THEN [Profit]
ELSE 0
END

Here’s a breakdown of what each part does:

  • IF [Category] &lt,&gt, 'Technology': This is the condition. Tableau checks the value of the [Category] dimension for each record. The &lt,&gt, operator checks if that value is not equal to the string 'Technology'.
  • THEN [Profit]: If the condition is true (meaning the category is anything other than 'Technology'), Tableau will return the corresponding value from the [Profit] measure.
  • ELSE 0: If the condition is false (meaning the category is 'Technology'), Tableau assigns a value of 0. Using 0 is crucial because it ensures the data still exists and won't break other calculations, but it won't contribute to sums or averages.
  • END: This keyword completes the IF statement.

After typing the formula, Tableau will show a message "The calculation is valid." at the bottom of the editor. Click OK to save the field.

Step 3: Add the Calculated Field to Your View

You can now use your new calculated field like any other measure. Find "Profit (Excluding Technology)" in the Data pane and drag it to the Rows shelf. Then, drag the [Category] dimension to the Columns shelf.

You’ll see a bar chart where 'Office Supplies' and 'Furniture' show a profit value, but the 'Technology' bar is flat at zero. You've successfully excluded it from your analysis without permanently filtering the data source.

Creating a Boolean Filter With "Does Not Equal"

Another powerful way to use the "does not equal" operator is to create a boolean (True/False) calculated field. This method is incredibly efficient for creating reusable filters that are easy for anyone on your team to understand and use.

Let's say you want to quickly exclude a specific region from a map visualization, for example, the 'South' region.

  1. Create a calculated field. Name it something intuitive, like "Filter: Not South Region".
  2. Write the boolean formula. The formula is much shorter than an IF statement:
[Region] &lt,&gt, 'South'

This simple expression evaluates each row and returns True if the region is not 'South' and False if it is 'South'.

  1. Add the field to the Filters shelf. Drag your new calculated field from the data pane directly onto the Filters shelf.
  2. Set the filter. A dialog box will appear. Check the box for "True" and click OK.

Your visualization will now automatically exclude all data from the 'South' region. This approach is cleaner than using the conditional filter dialogue because the logic is saved in a dedicated field, making it easy to apply across multiple worksheets and easy to edit in one central location.

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

Combining "Does Not Equal" with Other Operators

You can create more sophisticated logic by combining &lt,&gt, with operators like AND or by using the NOT() function. This lets you exclude data based on multiple criteria.

Excluding Multiple Items with AND

Suppose you want to see profit for transactions that were not in the 'West' region and were also not part of the 'Consumer' segment. You can use AND to link two "does not equal" conditions.

Create a calculated field named "Profit (No West/Consumer)" with this formula:

IF [Region] &lt,&gt, 'West' AND [Segment] &lt,&gt, 'Consumer'
THEN [Profit]
END

This calculation will only return a profit value if both conditions are met: the sale must be from a region other than 'West' and also a segment other than 'Consumer'. If either condition is not met, the formula returns NULL.

A Simpler Way to Exclude Multiple Values in a Dimension

Writing [State] &lt,&gt, 'California' AND [State] &lt,&gt, 'New York' AND [State] &lt,&gt, 'Texas' can get very long. A more readable way to handle this is by using the NOT and IN functions together.

To exclude multiple states, your formula could be:

NOT ([State] IN ('California', 'New York', 'Texas'))

This is a boolean calculation that returns True for any state that is not in the specified list. You can drop this directly on the Filters shelf and select 'True'. It’s much cleaner and easier to update than a long series of AND statements.

Common Pitfalls and Best Practices

When working with operators like "does not equal", there are a couple of common issues to keep in mind.

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.

String Comparisons are Case-Sensitive

Tableau's comparisons are case-sensitive by default. This means Tableau considers 'USA' and 'usa' to be two different values. A formula like [Country] &lt,&gt, 'USA' would not filter out rows where the country is written as 'usa' or 'Usa'. To get around this, standardize the case using either the UPPER() or LOWER() functions.

UPPER([Country]) &lt,&gt, 'USA'

This formula first converts the country value to all uppercase letters before comparing it to 'USA', ensuring all variations are correctly handled.

Handling NULL Values

It's important to remember that NULL represents an absence of a value. A "does not equal" check against a specific value will not automatically include rows with NULLs. For example, in [Category] &lt,&gt, 'Furniture', if a record has a NULL category, the expression doesn't evaluate to True, it evaluates to Unknown.

If you need to include NULL values in your "not equal" logic, you must explicitly check for them using the ISNULL() function:

IF [Category] &lt,&gt, 'Furniture' OR ISNULL([Category])
THEN [Profit]
END

This revised formula now includes records where the category isn't 'Furniture' as well as records where the category is missing entirely.

Final Thoughts

Mastering the "does not equal" operator (&lt,&gt, or !=) in Tableau is a fundamental step toward building precise and powerful calculations. Whether you're using it inside an IF statement to recode data or creating a simple boolean field for filtering, this operator gives you full control over what data to exclude from your analysis.

Of course, as your reports get more complex, you might find yourself managing dozens of small calculated fields and complex filter logic just to answer one business question. At Graphed, we decided to automate this entire process. Instead of creating calculated fields and filters manually, you can simply ask for what you need in plain English - for example, "show me my monthly profit from Shopify, but exclude returns" - and get an interactive dashboard instantly. It lets you focus on the insights, not the setup.

Related Articles