October 14, 2016

How To Use Filter To Remove Nulls From Calculated Field




This short & neat post describes an interesting solution on how to use filter to remove null values from a calculated field.


Scenario:  Users would like to have an option to filter null values from a calculated field. 


Error:  To filter null values, the calculated field is put in the Rows pane, converted to discrete, and selected ‘Show Filter’.  However, if ‘Null’ is de-selected from the filter, an error message ‘invalid filter predicate’ will appear.





Fortunately, there’s a work-around solution for this bug (which is noticed in Tableau Desktop 9.2 and 10).


Solution:  Put calculated field in Rows pane, change to Discrete, & select 'Show Filter'.  Change filter to 'Exclude Values'.  In the filter, select Null to exclude null values.