Do you want to hide Null values or other values from a Tableau filter? The following technique works to hide any values from a filter.
NOTE – this technique removes the values filtered out from the data / worksheet. Also, if using the Context filter, be aware of the affects that has on any FIXED LOD calculations.
Follow these steps:
1. Duplicate the filter field. For this technique we need a copy of the field.
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 copy field to context (right click on the pill to see this option). Set the quick filter pill, the original, to show values in context.
- Leave the copy field out of context. Set the quick filter pill to show only relevant 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 country is unknown. Therefore, to sum the correct total, the numbers can’t be excluded. In which case either leaving them as Null 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.