How to hide and show filters in Tableau dashboards
In this article, I am going to show you how to hide and show filters using a parameter. This technique will be helpful in scenarios where you need to hide certain filter cards in your dashboards (simply because they do not apply to the current view of your dashboard).
In this dashboard (viz), you can see that whenever the consumer segment is selected on the filter the category filter shows no data.
(Instead of showing a filter card with nothing to filter on, I am going to use a parameter to hide the filter ‘Category’ whenever Consumer segment is selected and show the filter back whenever ‘Corporate’ or ‘Home Office’ segment is selected).
Here is the dummy data am using.
Create the parameter ‘Segment Parameter’ (which contains all segments).
Create the view – which we are going to apply the parameter on.
Drag Sub-category to rows shelf.
Add SUM(Sales) to columns
Sort the view in descending order by Sales.
Use the parameter created above as a filter.
(This is made possible by creating this Boolean calculation and applying it as a filter - check the TRUE value)
Show the parameter control.
On a new blank worksheet.
Add the field ‘Category’ as a filter.
Ensure you show only relevant values.
Show the parameter control on the view.
Create the following calculation which will be used in hiding and showing category filter card.
While the current selection on the parameter control is ‘Corporate’ or ‘Home Office’, add the above calculation to the filter shelf and chose ‘TRUE’.
(This will hide the Category filter card whenever ‘Consumer’ is selected on the parameter and show the card whenever ‘Corporate’ or ‘Home office’ is selected on the parameter.)
Next, lets create the following calculation and add it to the label shelf and center it. (This calculation will be the name of the filter on the dashboard).
On the dashboard area, while on floating mode - drag both the worksheets to the view.
Hide the title for both the filter and worksheet.
Align them appropriately – for my case have appended worksheet right above the filter card.
Ensure the filter category is applied to the view.
Note that, the filter remains hidden whenever ‘Consumer’ is selected on the parameter and is shown whenever ‘Corporate’, or ‘Home Office’ is selected on the parameter.
I hope this was helpful to you. To receive more of the Tableau tips, kindly join our mailing list by subscribing below.
Thank you for reading.