Throughout my years working in data visualization, I have experienced an intriguing evolution. When I started using Tableau 10 years ago, I was interested in two vastly different ends of the spectrum of data visualizations: foundational concepts, such as building a bar chart and calculating aggregations accurately, and impractical concepts, such as creating a radial bar chart or making a trellis of quadrants that look like birthday cakes (I’m not kidding, I did do that!). Perhaps this is a shared learning path, but whatever skills lay in the middle wasn’t a focus of mine at the time.
By challenging myself to create charts and graphs that may be highly impractical in a business’s day-to-day work I still achieved incredible skill development. Stretching yourself beyond just foundational skills helps you learn to think more abstractly. It also can solidify your confidence in delivering on an idea.
One concept I hadn’t spent much time improving was developing dashboards primarily used to display a large table, such as a patient list or employee list. I assumed a list was a list and there wasn’t much to improve the user experience of using that list. Part of the failure in this belief is that it’s rooted in the assumption that no one likes lists (either to develop them or to use them), and therefore can never be improved.
It wasn’t until I began making numerous patient lists for clients as a final dashboard within a suite of reports that I realized there was an opportunity to use my technical and design skills to improve the user experience. While working with a client, it became clear that a few high-impact filters needed to be front and center to users, but instead of simply providing all the individual fields to filter upon, why not create an experience where users only needed to select one object to filter on a combination of key values? This got my mind churning and resulted in creating multi-filtering parameter-driven buttons, which is the basis of this blog post.
Multi-Filtering Button Use Cases
This method provides an exceptional user experience because these buttons can be predefined and include one or more dimensions or measure values to filter the data in the list view. For example, a high-impact or highly used combination of filters may be to view employees with a low-performance rating as defined by a value of 1 or 2 on a scale from 1 to 5. Therefore, instead of manually selecting values 1 and 2 from a drop-down filter or deselecting values 3-5, users can quickly select a button to filter the table list.
A similar high-impact filter combination could be to limit the table to employees who are Analysts or Senior Analysts and also who have been promoted in the past year, which combines certain selections from two different dimensions.
What about selecting a combination of filters? Using this method, users can easily click a desired button that simultaneously filters multiple selected values and even values across more than one field to quickly filter down the employee list. For example, a manager may want a curated list of employees who are considered “high-salaried” (salary over $100K), have a high absenteeism rate (value greater than 10), and have not taken the required annual training. The example below shows how selecting multiple buttons reduces the employee list to exactly what the manager has requested.
Additionally, using filter buttons such as this provides users a simple way to remove filters, or rather, return all original values into the view. This is a more enhanced user experience compared to using drop down filters that would require the user to click on the filter and select ‘All’ to reset the view to the original view.
It is key to remember that these parameter-driven buttons are designed to improve quick filtering and should be created to streamline the ease of filtering on a set of “most common” selections or combinations that your users may need. It doesn’t replace the need for additional filters that provide more customization, as seen to the right in the example dashboard. If users require access to every value and possible combination, then exposing the field as a filter may still be required. You can check out the example dashboard here as you follow along in this post.
Creating a Parameter-Driven Filter Button
The first step in creating a list that is easily filtered by buttons is to build your table. Here, I’ve created a list of employees that includes several key metrics in a simple table. Some values are discrete headers and others are measures, numeric values, but at the end of the day, it’s just a table. Now, let’s get to the fun part.
Step 1. Create a worksheet for each filter button
Each custom filter button will need its own worksheet, which is designed to look like a button. Open a new worksheet and title it “Button [Name of your Button]”. This button will be created using what I like to call the “fake axis” trick – using an in-line calculation such as MIN(1) or AVG(0) to create an axis.
Double-click in the Columns shelf to create an in-line calculation and type in MIN(1). This will create a bar chart in Tableau. Right-click on the axis header and select “Edit Axis” to set the range to a custom value from 0-1. This will ensure the bar takes up the entire width of the worksheet. Format the worksheet to remove all borders, the axis, and gridlines.
Next, create another in-line calculation on the Marks card with open and closed quotations (see image). After pressing Enter, drag the pill to Label. Click on Label in the mark’s card to edit it. Delete the contents and type in the label you’d like for the button. In this case, I’m going to label this button “Recently Promoted Analysts.”
If the space you’ve given the bar is too small you may not see your label immediately. That’s okay. You can increase the height of the bar by hovering over the lower edge until you see a bi-directional arrow, then drag it down. Format the button label however you’d like, such as increasing the font size and centering the text.
Because I’m lazy (i.e. efficient), I like to create everything necessary for a worksheet and then duplicate it before any further customization. In this case, it’s faster to make the most formatted version of the button and then duplicate it so you don’t have to start from scratch for each one.
So, let’s keep doing the simple parts before adding in the individual parts that customize each button.
Step 2. Add the Fields True, False, and Deselect
Create two calculated fields: True and False. Select “Create Calculated Field” and type the word TRUE (name it True) and FALSE in the other (name it False). You do not need quotations as this calculation is not a string, it will be a Boolean calculation.
Drag both the new “True” and “False” calculated fields onto Detail in the Marks card.
Next, create a “Deselect” calculation that includes simple open quotations. Drag this new field onto Detail in the marks card.
These calculations will be used later to drive the dashboard parameter actions and filter actions, so bear with me; they will come into play later.
Quick tip – if you are one who uses double quotations in your calculations, I’ll be the first to tell you to STOP. Why? Because holding the shift key then the quotation key is one extra key stroke and who has time for that?
By now your worksheet should look like the image below.
Now is a good time to duplicate the worksheet so you can create additional buttons with this base framework without having to start from scratch.
Step 3. Create a Parameter and Calculation to drive the buttons
Next, we need to create a parameter to drive a Boolean (T/F) to filter the list when the button is selected. For example, if I select the button we just created, I want the list to show only employees who have been promoted recently and are either analysts or senior analysts. When I deselect the button, I want all values to be true and in the list. As in, bring back showing all employees regardless of recent job promotion or job title.
Create a new parameter for the button. You can name it whatever your filter is going to be. For this example, it will be called “Employee List: Lower Rank Promoted.” Select the data type as Boolean.
Using this parameter, create a new calculation called “Employees Promoted Analysts” (again, whatever will indicate that this calculation is connected to the parameter just created). Below is the syntax required. Keep in mind that the values after the equals sign may be integers, dates, strings, etc.
CASE [Parameter You Just Created]
IF [Field You Want to Use]=’Enter the requirement for a True statement’
WHEN TRUE THEN
AND ([Secondary field if needed]= ‘Enter the requirement for a True statement’)
THEN TRUE ELSE FALSE END
WHEN FALSE THEN TRUE
END
I will explain what this calculation is doing in step 4, but this calculation will drive what is shown in the table/list.
Once you have the calculation, place it on details in the marks card. Then, drag the corresponding parameter onto colors in the marks card. Assign colors to the true/false values as you want them to display when the button is selected or unselected. An easy way to do this is to expose the parameter so you can easily switch between the two values to change the color. I like to select a dark/saturated color for when the filter button has been engaged, turned on, and then a lighter version of the color (or a light gray) to indicate the button is deactivated, turned off.
Step 4. Add Calc to Filters
Next, go to the worksheet of your table/list and add the calculation we just created in step 3, called “Employees Promoted Analysts” (or the main button calculation) to the filter shelf and select the value True.
Let me explain in plain language with examples what this calculation is telling Tableau to do one section at a time.
CASE [Parameter You Just Created]
WHEN TRUE THEN
IF [Field You Want to Use]=’Enter the requirement for a True statement’
AND ([Secondary field if needed]= ‘Enter the requirement for a True statement’)
THEN TRUE ELSE FALSE END
WHEN FALSE THEN TRUE
END
The above statement says, when the parameter value is set to True then look for all rows that meet the following criteria and tag these rows as TRUE. All other rows are tagged as False.
CASE [Parameter You Just Created]
WHEN TRUE THEN
IF [Field You Want to Use]=’Enter the requirement for a True statement’
AND ([Secondary field if needed]= ‘Enter the requirement for a True statement’)
THEN TRUE ELSE FALSE END
WHEN FALSE THEN TRUE
END
The second part says, if the parameter value is set to False then everything is True, since there is no criteria to state otherwise. When this calculation is on filters and set to True, all values will show in the table when the parameter is set to False, but when it’s set to True the defined criteria will be applied and only those rows matching the criteria will remain in the table.
Step 5. Hook Up the Cycle Calc
What do I mean by the cycle calculation? You can see another version of this calculation in this dashboard when you select the icon in the top right corner. The objective is that when the parameter action is set up, we want the action to cycle from TRUE to FALSE and change the calculation to either filter for our selected criteria or bring in ALL values (meaning everything is true).
Create a new calculation, which you can call “Employees Promoted Analyst Cycle” (or I copy the prior calc and modify it). This is used later in the Dashboard Parameter Action to force the button to change from TRUE to FALSE, upon selection.
CASE [Parameter]
WHEN TRUE THEN FALSE
WHEN FALSE THEN TRUE
END
Then place this calculation on Detail on the Marks card. By now, your worksheet should look like this (see image).
Step 6. Dashboard Parameter Action
Once your button worksheet is set up and the main button calculation is placed on the filter shelf of your text table worksheet, you can place both the list and button onto a dashboard. Format the button worksheet to hide the title and set the fit to “entire view.”
Two dashboard actions are needed for each button: a parameter action to change the parameter value from True to False and a filter action to deselect the button so that it appears that it’s turned off (this is more of a design-related requirement than a functional one).
From the menu bar:
- Choose “Dashboard” and then “Actions.”
- Select “Add Action” and choose “Change Parameter.”
- Name the Parameter Action to correspond with your action, such as “Promoted,” in my case.
- The source sheet is the button worksheet.
- Select to run the action on “Select,” and the Target Parameter is the corresponding parameter from earlier (here it is “Employee List: Lower Rank Promoted”).
- The Source Field is the Boolean “cycle” field we created in Step 4, and the aggregation can remain at “None.”
- Under “Clearing the selection will”, select the radial button “Set value to” and choose False. This will initiate the cycle from True to False and back again for the calculation.
Step 7. Filter Action for Deselect
The last step is to create a filter action that deselects the button, so it doesn’t remain in a “selected” state. This is a “nice-to-have” addition and simply adds value to the user experience. I show the difference in the image below. When someone selects the button, it changes color but doesn’t stay selected (notice the black border), which is typical of how Tableau handles selected marks.
To create this deselect effect, we need to set up another dashboard action.
From the menu bar:
- Choose “Dashboard” and then “Actions.”
- Select “Add Action” and choose “Filter Action.”
- Name the Filter Action to correspond with your button worksheet, such as “Clear Promoted,” in my case.
- Select to run the action on Select and set the target sheet as the button worksheet.
- Choose to set the clearing selection to “Show all values.”
- Change the Filter options to selected fields (radial button) and choose the source field of “False” (remember we put this on detail earlier) and the target field set to “True” (again, it should already be on details). The order of these doesn’t matter as long as one is the source and the other is the target field.
The reason this works is because the condition True = False can never be true. Therefore, the worksheet doesn’t get filtered and no selection happens. In fact, Tableau immediately deselects the selection because there is nothing to highlight as filtered.
Hit Okay.
Step 8: Repeat steps for additional filter buttons
For additional buttons, take the duplicate worksheet, rename it for your next button, and repeat the same step to create more. Additionally, repeat the steps to create each individual button parameter, calculations, and dashboard actions.
Finished!
You should now have a pretty slick dashboard with user-friendly one-click buttons for prefiltered selections, which otherwise would have been a boring table with too many filters for users to sift through. The critical takeaway here is to know your users. By understanding their top priorities and most common filtering selections, you can craft buttons that reduce the burden of multi-select filters and put solutions directly into stakeholders’ hands. A table or list like this is bound to “wow” your users.
You can interact with and download the workbook here.
Problems, Even Boring Ones, Drive Innovation
In a previous blog post, I shared my thoughts on why constraints (such as making a boring list table) can contribute to new ideas and innovations. I encourage you to continue to think about your users’ needs and what will improve their overall experience using a dashboard. What will increase their efficiency in getting their question answered? What would make it more enjoyable? What features will make them feel like you thought about them, and how do they tend to interact with the data? Even tables and lists, such as this employee list example, can add a tremendous amount of value.
Don’t forget to subscribe to HealthDataViz’s blog for more data visualization and Tableau-related content! Also, check out our Tableau Public profile for more dashboards and corresponding blog posts.
0 Comments