Filtering Out The Garbage: Tableau Filter Basics

Kevin Macias-Matsuura
5 min readOct 25, 2020
Photo by Maurício Mascaro from Pexels

In my last blog post I touched on a few basics for building simple graphs and dashboards. In this blog post I intend to dive a bit deeper into customizing graphs to make them interactive through the use of filters. For this post I will be using a data set that I created myself from insideschools.org. This data set is a collection of 22,662 comments from all non-charter public schools in New York City. To begin let’s take a look at some ways to filter categorical variables.

The graph above shows comments for each borough in NYC by the school’s grade level. Let’s suppose we wanted to limit the graph to see only middle schools. To accomplish this we can do a couple things. We can drag the “Grade Level” pill from the tables column into the filters section to the right. We can also hover over or right click the “Grade Level” pill and access “Filter…” from the dropdown menu. From there we will be brought to the filter menu.

For categorical variables we can simply select or deselect to display the selected fields. Within the “General” tab of the “Filter” menu there are a couple more features available in the bubble select menu. “Custom value list” will give the option to type a list of variables to include. This could be useful if we have a large list of cities or customers but only need a subset of variables. If these values are stored, for example, in an excel sheet, we could copy and paste the values in the “Custom value list” field to filter by only those names. The last option of “Use all” is pretty self-explanatory. The next tab over is the “Wildcard” tab.

This section functions like a regex search which allows you to filter values based on particular search criteria. This could be useful in a case where we have a list of user email addresses and only want to display gmail addresses. You could select “Ends with” and specify @gmail.com in the “Match value” field to limit the display to only gmail addresses. The “Condition tab allows us to limit the results to a range of values.

We can easily select the range using the fields provided in the menu or we can select the “By formula” bubble and create a more complex condition. Typing any letter in the “By formula” field will display a list of suggestions for condition parameters and variables, but for a more detailed list of all the functions (going through the list is a whole other blog post) you can browse through the link provided here: link. The last tab we have access to is the “Top” tab.

As self-evident by the title, this tab allows us to limit the results to the top x number of categories by whatever criteria we choose. Like the “Condition” tab, we can specify more complex formulas to delineate what attributes our top categories must have. After we select how we want to filter our categories the graphs will adjust accordingly. To make the graphs interactive we need to display the filters to interact with in real time. To achieve this simply access the dropdown menu in either appropriate pill (from the columns or filters sections) and select “Show filter”. This will make an interactive filter card appear next to the graph. Here we can select which categories we want to display in real time to give a more detailed view of the graph values we want.

Filtering numerical variables will give us a different set of options.

Here we can select a range of values by either moving the slider or by specifying the numbers directly. When you have multiple filters there may be issues with values that are not relevant to the filter criteria. For example Sijia Wei gives a great example you can find here: link. You may have a situation where you have a University filter and a Subject filter. When you drill down to a certain university it may not have every subject causing the view to disappear when selected. To remedy this you would select “Show: Only Relevant Values” instead of “All Values In Hierarchy” or “All Values In Database”. The “Special” tab allows us to include or exclude Null values. As an important note. If your filters are not showing up the way you expected you may need to check the order of operations. Filters are displayed accordingly and there are ways to change filters to move them up or down in the order of operations. You can find more about that here: link.

To end this basic intro to filters I want to take a minute to look at a different method of “filtering” by using hierarchies. By default, if you use date fields in your data source Tableau will automatically create a hierarchy to more easily see months, days, or years. We can also create new hierarchies to quickly drill down into more detailed aspects of a graph. For example, for the same graph we can create a hierarchy by dragging and dropping the “Borough” pill over the “Grade Level” pill. We can choose to rename the hierarchy and drop it into the columns section. By default we will see the standard count of comments by borough.

To drill in to a more detailed view of boroughs by grade level we click on the plus icon that is now in the left hand side of the pill.

The amount of customization you can create through filters is fairly vast. It would serve you well to play around with some of the parameters and see how they effect your graphs. This guide should give you enough to get started adding some interactivity to your graphs. The same filters can be added and moved around in your dashboards to really make your graphs shine and to provide real time analysis for anyone viewing your work.

--

--

Kevin Macias-Matsuura

Former English teacher turned Data Scientist/Analyst interested in data, design, and storytelling.