Filters in Tableau
Filters help to segregate the dataset based on some conditions and use the filtered data for visualization. In Tableau, filters remove irrelevant records and minimize the data size for better efficiency. Filters also help to protect sensitive information and give access to only relevant information.
This blog gives you a detailed explanation of different types of filters in Tableau and how they can be used to organize and simplify the data.
Types Of Filters
Data Source Filter
Table Calculation Filter
Extract Filter: Extract Filters are used to filter the data extracted from the Data Source. After connecting to the data source you will see two options, Live and Extract at the top right corner. The Live connection is directly connected to the data source and an Extract connection extracts the data from the data source and saves it in Tableau Repository on the local machine. Extract Filters help to restrict the data that we save to our local machine from the server.
Following are the steps to create Extract Filter:
Step 1: Connect to the Data Source.
Step 2: Click on the Extract radio button.
This will create a local copy
Step 3: Select Edit next to the Extract in the top right corner. The Extract Data window is opened. Select the Add option.
Step 4: After clicking Add option, Add filter window is opened. Select any field based on the filter condition. Select the Category and click OK.
After clicking OK, a filtered window will appear which shows the category to which you can apply the filter.
DataSource Filter: A data source filter is used to filter the data at the data source level. This filter restricts the data coming into the tableau environment and users can only see the filtered data in tableau. The Data source filter is applied to both Extract and Live connections. Extract and Data Source filters are independent of each other. So if we change back to the live connection our data source filter will still be intact.
Step 1: Click on Add button in the top right
Step 2: Edit Data Source Filters window is opened and click on Add.
Step 3: It will show us a list of all the fields and we can select the field to which we want to apply the filter.
Context Filter: A Context Filter is an independent filter and has the highest priority of all other filters applied. Tableau creates a temporary dataset in the repository engine based on the context filter selection and whatever filter we apply next will work on the filtered dataset created by the context filter. Following are the steps for creating the context filter.
Step 1: Drag the dimension to be added as a context filter to the filter shelf.
Step 2: Click on the dimension and select Add to Context
Step 3: Once the filter is selected as a context filter, the color of the dimension box changes to grey color. This grey color box is an indication of the context filter.
We can remove the filter from context by right-clicking the dimension and selecting the Remove From Context option. The color of the dimension changes back to blue as an indication.
Dimension Filter: When we use dimensions to filter the data in a worksheet, it is known as Dimension Filter. These are non-aggregated filters. The Dimension Filter is added just by dragging the dimension field to the filters card. Dimension Filter can be shown in the worksheet and dashboard to change the filter value dynamically. Following are the steps to add the Dimension Filter.
Step 1: Go to the sheet and select the dimension to apply the filter. In this example, we dragged the Category and put it on the Filter shelf. Select the category to which the filter needs to be applied.
Step 2: The above steps will show only the records for the Furniture category.
Measure Filter: When we use Measure to filter the data in the worksheet, it is known as Measure Filter. These Aggregated filters are applied after Non-Aggregated filters, no matter what order they are applied on the Filters shelf. While applying this filter, tableau will ask what aggregation(sum, count, average, median, etc..) we want to apply the filter. Below are the steps for applying the measure filter. In the following example, we are using sales to filter our data.
Step 1: Drag the measure into the ‘Filter’ shelf. The Filter field window is opened. Select any of the aggregations from the list. In this example, Sum is taken as the aggregation type. Click on the Next button.
Step 2: It opens a window where we can select an option to apply the filter.
Range of values Minimum and maximum range of measure values can be given and filtered.
At least A minimum value of a measure is given to filter the data.
At most A maximum value of a measure is given to filter the data.
Special An option to select null or non-null values and filter the data.
Step 3: Select the Range of values and edit the upper and lower limit. Click OK.
This will filter the data set for the sum of sales value between 0 and 2500000.
Table Calculation Filter: The Table Calculation filter is the last filter that is applied after the view has been created. If we want to add a filter to the view, the Table Calculation filter will do the work without filtering the underlying data.
These are six main types of filters. Besides these filters, there are other useful filters that Tableau provides.
Global Filter: When we apply the filter to the worksheet, by default it is applied to the current worksheet. But if we want to apply the same filter to multiple worksheets that use the same data source we can apply the filter globally rather than applying the filter each time we create a worksheet.
Cascading Filter: Cascading Filters allow the value selection in the first filter to change the value in the second filter. For example, if we select Office Supplies in the filter then only the relevant values related to office supplies in the Sub-category filter are displayed.
User filter: The User filter provides row-level security in Tableau. It is a feature that restricts and manages the data that users can view or access based on the authority given. Different filters can be applied for different users. For example, suppose there are three departments and we want users to get access to only the data related to their department. This is where we can apply User Filters while publishing the workbook to the server.
Filters are an important feature provided by tableau. Tableau filtering feature allows both simple scenarios using field values as well as advanced calculation or context-based filters. In this blog, we have seen different types of filter, and how these filter works. Hope this blog will be helpful. Thanks for reading.