Get startedGet started for free

Tableau filters

1. Tableau filters

In this screencast you’ll learn more about the different types of filters. Let’s start by learning how to add a data source filter. A data source filter is used to filter the data at the data source level. It can restrict the records present in the data set. They can be useful for restricting the data users can see when you publish a workbook or data source. To create a data source filter, you need to go to the Data Source page. In the Data menu here on the left, navigate to Edit Data Source Filters, and in the pop-up window click Add. Let’s limit the data based on Region. Imagine only sales representatives for the East region will use your dashboard. There wouldn’t be any need for them to see figures from other regions. I’ll click OK. Now you can see the filter has been added. Recall from the video about Tableau’s order of operations, data source filters will be executed before context filters, dimension and measure filters, and table calculation filters. So if you add any of these filters later on, they will be executed only on the data of the Eastern region. Another interesting filter type is the context filter. Let’s see how to create one. I’ll add Sales to Columns and Sub-Category to Rows. Let’s sort the data as well. Now, I’m going to add Sub-Category to the Filters shelf. In this pop-up box, I’ll go to Top and create a filter for the top 4 sub-categories based on their Sales values. Click OK. Now we see only the top 4. Let’s add another dimension filter to show only the Office Supplies products. I’ll right-click Category, show the filter, and select only Office Supplies. Now the view is filtered, but instead of showing the top 4 Office Supplies products, it shows only one. This is because by default the dimension filters are executed separately and the view shows the intersection of the results. So in this case what happens is that for the top 4 calculation, Tableau takes all rows in the dataset and calculates the top 4. For the Office Supplies filter, it once again looks at all rows in the data and keeps only Office Supplies items. Then it will look how many of the top 4 overall items are also Office Supplies items. What we actually want to achieve is to get the top 4, Office Supplies items. We can accomplish that by using a Context filter. Because of Tableau’s order of operations, Context filters will be executed before Dimension and Measure filters. I’ll create the Context filter by right-clicking the Category filter and adding it to Context. You’ll see that that greys out the Category pill. Everything that we are going to do now is only going to be applied to data that has already been passed through the Category filter. This is what we want to have. If we now select different categories, we still have a top 4. So if you have some characteristics that you want to exclude from your workbook, context filters are a great way to do it. They can help you boost performance since they reduce the number of records used in your worksheet. Every Dimension or Measure filter applied, will only look at the data after it’s been filtered by the context filter. Similar to Dimension filters, which is what the Sub-Category filter is here, Measure filters can be added by simply dragging the field to the filters shelf like this. For example, if I right-click Sales and then Show Filter, you can see that it has been added to the Filters shelf as a Measure filter. That’s it, your turn!

2. Let's practice!