Do you want to hide Nulls from a Tableau filter? This article shows two ways to hide Null or any other values from a filter.
NOTE – both technique removes the values from the data / worksheet. Also, if using the Context filter method, be aware of the affects that has on any FIXED LOD calculations.
Remove Null from filter by Duplicating the Dimension
To remove null from a Tableau filter by duplicating the field, follow these steps:
1. For this technique, we need a copy of the field containing the filter values. Therefore, duplicate the dimension (right-click on the dimension and ‘Duplicate’).
2. Put the duplicate field to the filter shelf. Next select the values you want to hide – i.e. Null – and click exclude on the right of the filter box.
3. Put the original filter field to the filters shelf – there should be the original and the copy on the filters shelf
4. Show the original filter
5. Now there are two choices:
- Add the duplicate dimension to context (right click on the pill to see this option). Next, set the filtering pill (i.e. not the duplicate), to only show values in context.
- Leave the duplicate field out of context and set the filtering pill to show only relevant values.
Remove Null from a Filter using a Set
Another option to remove the null values from a Tableau filter is to use a set. Remember, this also excludes the values from the worksheet. Do the following to create the set without Nulls:
1. Create a set on the Dimension containing the filter values. Right-click on the dimension and Create – Set.
2. Exclude the Null (or other unwanted values) from the set
3. Put the new Set to the filter shelf. This should remove the Null and any other values excluded in the previous step. To check you can “Show members in set” and then “Show Set”.
4. Put the filter field to the filter shelf, where it should automatically only include the items not excluded in the set.
Hide Null from a Filter and Keep the values
Sometimes the data with the Null values is needed in the worksheet data. For example perhaps you want to sum total sales including those where the Region is unknown.
Therefore, to sum the correct total, the numbers can’t be excluded. In which case, either leaving the Nulls or renaming the Null values to something else is preferable.
The Tableau IFNULL formula can rename Null values in Tableau.
It is far simpler to remove the All from a quickfilter. See the Customise option of the quick filter settings.
Remove the Null from a filter from a secondary data source
When blending data sources in Tableau, if using a dimension filter from the secondary source, Tableau will include a Null at the top of the filter values list.
Unfortunately, there isn’t an option to get rid of this null from the filter.
The only workarounds I’m aware of are:
- Use a parameter as a filter – which has it’s own difficulties so won’t work for all use cases
- Switch the data sources, so the data source with the filter field becomes the primary data source (read the article on data blending for more information on this)
- Use the Tableau scaffold technique to produce a list of all possible filter combinations; use this as a primary source and blend in the other data as secondary
None of these options are ideal; an only relevant values option for filter in the secondary data source is preferable, but isn’t yet possible.