Embedded Analytics: How to create a Collapsible Filter Menu
Updated: Sep 30, 2018
With the advent of extensions and ever-improving API connectivity, Tableau is now more than ever one of the best software for embedded analytics. Enterprise users are becoming very comfortable molding Tableau dashboards to seamlessly fit into existing platforms, such as websites and web apps. However, with decrease screen sizes comes the need for display optimization.
One of the most commonly requested design features I receive is a collapsible filter menu that can be stowed away to maximize dashboard space for data analysis. Here, I’ll break down and explain the mechanics of how to create a collapsible filter menu for your Tableau dashboards.
1. Start with any prebuilt sheet in your workbook. I am using a very colorful time-series graph in this example, along with three data source filters I’d like to display.
2. The key to having a dynamic menu is having data points that you can use to trigger the command. The two commands we need will be to “Show” and “Hide” the menu. We need to create two data points to do exactly that. In a text editor (or Excel workbook), create a singular data column contain contains these data points. I used Notepad to create my data column.
3. Save this file down and add it to your existing working as a New Data Source.
4. Next, we will create a “Show” button and a “Hide” button in two new, separate sheets. In the sheet that contains the “Show” button, filter the Show/Hide dimension respectively. Do the same for your “Hide” sheet. You can customize your buttons with a shape file or free text. Here, I am using built-it shape icons.
5. In a new sheet, drag the Show/Hide dimension into your pane. Duplicate the Show/Hide dimension and use it to filter on “Show.” The reason we do this is because we will later drive the collapsing menu function via an action filter. This sheet will be used as a space filler, so using the duplicate dimension ensures it will not be affected by the action filter.
6. Now, we start assembling our dashboard. For the sake of simplicity, I chose whole numbers for this example. The finished default dashboard will be 800x800 pixels. Create a new dashboard, size it according, then float in a horizontal container.
7. In the layout panel, position this horizontal container at (0,0) and re-size it to be 1200x800
8. Insert the Blank Sheet and 2 vertical containers into the horizontal container. Size the first two objects to be 200px wide, and the third object to be 800px wide. Right-click on the dropdown carrot of each object to fix the width of ONLY the vertical containers. (Do not fix the sizing of the blank sheet!)
9. Drop the “hide” button and all your filters into the smaller vertical container. Drop the “show” button and main graph into the large vertical container; from the dropdown carrot, fit this sheet to show “Entire view”. Finally, right-click on and hide the titles of all your sheets.
10. Return to the Layout panel and shift the original horizontal container left by 200px (you can use negative values for object positioning; enter “-200” as your x-position)
For Source Sheets, select the sheets that contain your show/hide buttons.
For Target Sheets, select your blank sheet.
Configure the action to run on Select.
Clearing the selection will: Leave the filter.
Allow All Fields to be targeted
11. Return to the Layout panel and shift the original horizontal container left by 200px (you can use negative values for object positioning; enter “-200” as your x-position)
12. Voila! You have created a collapsible filter menu in Tableau. Test your buttons to ensure that they work. Your final product should function like the sample dashboard below.
This concept works for any design or layout you would like to use to structure your menu. Note that you may also add other objects such as images and text boxes containing instructional verbiage, so long as they all fit into the smaller container. Re-sizing this dashboard template will require a little math but use the diagrams above to conceptualize how to break down differently sized dashboards to fit your needs.