Tableau 101: Tableau FiltersBy: CoEnterprise | June 27, 2018
The filter is one of Tableau’s most essential features. It allows users to efficiently comb through large datasets and focus on relevant information to find valuable insights. Imagine you have a massive dataset containing information on different countries over the last decade. You can spend lots of time working through a mass of data or more efficiently focus your information on specific countries and years. Filters enable you to target your analysis.
In this post, we will give you a breakdown of filters, how to create them and manage them, and how to effectively get the most out of them for your specific goal.
Level 100: What is a Filter?
Filters control which rows of data are included in your analysis. Setting a dimension or measure as a filter allows you to exclude certain data values from the selected dimension or measure. For example, setting the Country field as a filter could allow you to show only rows of data that pertain to Canada. It gives you full control over what rows you display.
Filters in Tableau work in parallel. If you set a dimension as a filter and then set another dimension as a filter as well, Tableau will feed all your data through both filters and combine the results with AND logic. This means you will get a simple combination of results and the results of one filter will not feed through another filter by default.
To learn how to create a cascading filter, read on to Level 301: Create a Context Filter.
Level 101: Create a Basic Filter and Give the User Control
There are three basic ways to create a filter:
- Drop a field into the Filters card as a quick filter.
- Right click on a field and select a field as a quick filter.
- Use an action filter on your dashboard.
Note: Images use Tableau’s World Indicators dataset.
The first method for creating a filter is done in a Tableau sheet. First, select the field that you want to use as your filter. Then, drag that field onto Filters, and a window will open.
You have the choice to filter on a dimension or a measure. A dimension is usually a field (like a category) that you cannot aggregate, and a measure is quantifiable.
To Filter on a Dimension:
Dimension filters allow users to choose which categories are analyzed in their views. The window will default to “General” and show each distinct row in the selected field. You can now unselect or exclude whichever rows you want. The “Wildcard” tab allows you to select all rows that contain specified characters. The “Condition” tab allows you to enter a condition based on a selected measure to filter out certain rows. The tab “Top” allows you to choose the rows with the top X amount of a certain measure.
To Filter on a Measure:
Measure filters differ from dimensional filters because the values they contain are aggregable. When you drop a measure field onto the Filter shelf, a window will pop up asking how you would like to aggregate the measure. It will then give you the option to select either a range of values, a minimum limit, a maximum limit, or special values. The special values option allows you to filter out null and non-null values.
Once you have created a quick filter, right-click the field on the Filter shelf and select “Show Filter” to expose the filter control in the worksheet. You can modify how the control appears and works by clicking the down arrow to the right and selecting one of the options.
Another way to filter a dashboard is by right clicking on a field. Simply drag the field you want into the view, right click on a data point in the field, and click exclude. You can now exclude all rows with that piece of data from the view.
Level 201: Create an Action Filter
The third way to filter your data is through an action filter. This directly applies filters from one sheet to another on your dashboard. To filter from one sheet onto every sheet on the dashboard with the click of your mouse, go to the small filter icon at the top right of the sheet on the dashboard. Now, when users click on a row of data, they will filter the rest of the dashboard to that specific value.
If you want to edit this filter to only apply it to selected sheets, click on the “Dashboard” menu at the top of the page, and then click on “Actions.” A window like the one below will open, listing all the action filters that have already been created.
Click on the action filter that you want to edit. Click the “Edit” button and the following window will open.
You can now click on the sheet that you want to use as the source filter, and the target sheets that you want to apply the filter to. The action filter gives you the option to run the action on hover, select, or a menu. When you clear the selection, you can either leave the applied filter on the dashboard, show all the values, or exclude all values. Action filters also allow you to choose the fields within the sheets that you filter on, using the “Target Filters” section at the bottom.
Action Filters vs. Quick Filters
Action filters and quick filters have similar purposes but are different when it comes to how the user interacts with them. Quick filters are initiated when a user selects in a filter menu. Action filters are triggered by clicking on or hovering over a mark in a dashboard view, or by clicking a link in a tooltip menu.
There are cases where quick filters are the best option, but we prefer to use action filters in most cases for two reasons. First, action filters keep you in the ‘flow’ with your data. Second, they tend to be better for performance. Quick filters, on the other hand, allow users to use wildcard searches, select multiple fields, and hide filters from dashboards.
Level 301: Create a Context Filter
The next topic we will discuss is context filters. Filters operate independently of each other on a sheet. For example, imagine you have two filters on your sheet, one that lists out all the states in the U.S. and another with the national parks in each state. If you were to filter on a specific state, all the national parks in the U.S. would still show up in the national park filter list. Ideally, once you have selected the state you want to look at, you only want to see the national parks in that specific state listed. This is where context filters come in.
Right click on the filter in the Filters card that you want to apply first. In this case, right click on the “States” field. Then click “Add to context.” This will apply the states filter to the sheet first. Next, go to the national park filter and click on “Show filter” so that the filter pops up on the sheet. Then click on the dropdown arrow on the top right of the filter and click “Only relevant values.” This filter will now only show national parks in the state that is selected.
Table Calc Filters
If you use Tableau regularly, you probably know how powerful table calculations are. Unlike other calculations, table calcs refer only to the temp table behind each worksheet in a workbook. This fact allows you to calculate values like a percent of total, or rank, using just what is in the level of detail of the view. What you may not know is that table calcs can also be used as filters to take advantage of that fact. They allow you to filter the view without filtering the underlying data. They are easy to create using a simple table calculation and dropping it into filters.
Extract and Data Source Filters
There are two types of filters that Tableau applies even before rendering a view. Extract filters allow you to determine which data is included in the extract.
Data Source filters are applied after the extract is created. They do not change the size of the extract. Rather, they restrict selected records in the extract from being called in queries. The data is still in the extract but will not appear in views. Data source filters are often used to restrict what portion of a data set certain users can see.
No discussion of filters in Tableau would be complete without considering the order in which Tableau applies them. This is important because their interactions become more complex as the number of filters in a workbook increases. Understanding filter order will help you avoid filter conflicts and achieve efficiency with your dashboard
Filter order is also important in calculating level of detail (LoD) expressions. The power of LoD expressions comes from the fact that they ignore some, or all, of the level of detail in the view in which they are active. Fixed expressions ignore the worksheet’s level of detail altogether. Include expressions consider one or more fields that are not active in the worksheet, and Exclude expressions ignore the selected fields.
Note: In the image below, the context filters are applied before fixed calcs. Therefore, if you need a filter to affect a fixed LoD expression, promote it to context.
There is an endless list of applications and hacks pertaining to filters, from complex calculations to sets and parameters. This post is intended as an introduction to basic filters and how they can be used at their simplest level. To dive further into filters, checkout tutorials on Tableau Help and Tableau Community.
Want to see how you can take your Tableau projects to the next level? Learn more about how our Tableau experts can help grow your skills today.
Subscribe to our resources!
Sign up to receive our latest eBooks, webinars, blog posts, newsletter, event invitations, and much more.