What are Tableau Filters?
Tableau filters are extensively used in Tableau to narrow down the data in your dataset, which can be used further for data visualization or analysis purposes. They allow users to focus on a specific set of data from the entire population, thereby reducing the overall data to be analyzed. Tableau provides filters that can be applied to different levels of data, ranging from data sources to data fields, making it a pretty powerful tool for meeting your visualization requirements.
A sample Tableau filter is shown below. You can use the filter on the Segment field to create an interactive visualization of your dataset.
In the next section, we will understand the different types of Tableau filters.
Table of contents
Key Takeaways
- Tableau Filters are one of the key tools in Tableau to narrow down the data in your dataset for data visualization or analysis purposes.
- There are different types of filters supported in Tableau including Extract Filter, Data Source Filter, Context Filter, Dimension Filter, Measure Filter, and User Filter.
- These filters are executed in a specific order called Order of operations and hence understanding each of these filters can be highly critical for optimal data visualization.
Types
Tableau supports different types of filters, and they are executed in an order called the Order of Operations. These filters include:
- Extract Filters
- Data Source Filters
- Context Filters
- Dimension Filters
- Measure Filters
- User Filters
#1 – Extract Filters:
These filters are applied for the data extracts and allow you to filter the data fields and choose to include and exclude attributes.
To apply extract filters
Step 1: Navigate to the Data Source tab and select your dataset from the Sheets pane.
Step 2: Choose the Connection type as Extract and Click on Edit link.
Step 3: In the Extract Data window, expand the Filters section and click on Add Filter drop-down.
Select the fields in which you want to add the filters.
Step 4: Provide your choice of whether to include or exclude the values. Click on Save Settings.
#2 – Data Source Filters:
These are applicable for Live connection Tableau filter data source. Apply these filters to the data fields and choose to include and exclude attributes.
Step 1: Select your dataset and choose Connection as Live. Click on the Add link.
Step 2: In the Edit Data Source Filters, Click on the Add -<field to apply filter> – OK.
Specify the filter conditions and click on OK.
It will add the filter for your dataset.
#3 – Context Filter:
These filters are independent filters that help you to ensure any other filters you define for your visualization pass through these filters.
To create context filters,
Step 1: Create a data visualization by dragging the dimensions and measures to the Rows and Columns section.
Step 2: Drag the sub-category to the Filters shelf and apply the Tableau filter top 10.
Step 3: Add more filters to the Filters shelf by dragging the Category field and choosing both Office Supplies and Technology values.
Step 4: Right-click on the Category on the Filters shelf and select Add to Context.
It will ensure that any filter on the Sub-category passes through the Category. which is a Context filter.
#4 – Dimension Filter:
These filters enable users to apply any filters on dimension/categorical data fields such as Category, Region, Product, etc. To apply a dimension filter,
Step 1: Drag the dimensions and measure to the Rows and Columns section as applicable.
Step 2: Drag the dimension to the Filter shelf and choose the filter condition.
It will create a Dimension Filter for your visualization.
#5 – Measure Filter:
These filters enable users to apply filters to quantitative data based on aggregated values such as SUM, AVERAGE, MEDIAN, MAXIMUM, MINIMUM, etc., using the measures (Sales, Profit, etc.).
To apply the measure filter:
Step 1: Create a visualization using the Dimension and Measures in the Rows and Columns section. Drag Sales to the Filters shelf. Choose Sum and click on Next.
Step 2: Specify the filter condition and click on Apply to create a Measure filter.
#6 – User Filter:
These filters are user-centric and help you narrow the data view for applicable users, i.e., enabling different data views depending on user context.
Step 1: Create a data visualization in a new worksheet in Tableau.
Step 2: Navigate to Server – Create User Filter – Region (the field you want to create the filter).
Step 3: Log into the Tableau Server site and specify the users for whom you want to provide access to view your visualization.
Examples
In this section, we will go through different examples demonstrating the Tableau Filters.
Example #1 – Extract Filter
In this example, we will demo creating an extract filter using the Cars dataset. It comprises a collection of used car listings from different locations, including the car’s make, model, year, mileage, price, exterior and interior colors, drivetrain, MPG (miles per gallon), fuel type, and transmission.
Step 1: Import the Cars dataset in Tableau by navigating to the Data Source tab and using the File navigator, i.e., File – Open.
Step 2: Choose the dataset, select the Connection type as Extract, and Click on the Edit link.
Step 3: In the Extract Data window, expand the Filters section and click on Add Filter drop-down.
Select the fields you want to add the filter and specify the filter conditions for each field for which you want to apply the filter, as shown below.
Once the changes are defined, click on Save Settings to save the changes.
Example #2 – Data Source Filter
In this example, the Oil Production Dataset contains comprehensive insights into oil production across 36 countries from 2021 to 2023, detailing country names, types of production, product specifications, flow information, and corresponding production values. Follow the instructions to create the Tableau filter data source:
Step 1: Import the Oil Production Dataset in Tableau using the File navigator, i.e., File – Open.
Step 2: Choose the dataset, select the Connection type as Live, and Click on the Add link.
Step 3: In the Edit Data Source Filters, Click on Add. Choose the filter value, i.e., Europe, and click OK.
It will add the filter to your dataset.
Example #3 – Context Filter
For this demo, we have leveraged the same Oil Production Dataset to create a context filter in Tableau.
To create a context filter in Tableau, follow the steps below:
Step 1: Navigate to a new worksheet in Tableau.
Step 2: In the new worksheet, drag the Product to Rows and Value to Columns section.
Step 3: Click on the sort descending order icon to sort the visualization as per the value field.
Step 4: Click on the down arrow next to Product and select Filter.
Step 5: On the Filter window, navigate to the Top tab and select Tableau filter Top 10 by Value.
Step 6: Add the Flow field to the Filters shelf and choose Consumption Pattern.
Step 7: Right-click on the Flow field on the Filters shelf and select Add to Context.
Example #4 – Dimension Filter
Now, let’s look at creating a dimension filter using the Vehicle Fuel Consumption dataset. The Vehicle Fuel Consumption dataset contains information on a wide range of vehicles from different years, makes, models, engine specifications, fuel types, and transmission systems.
To create a dimension filter in Tableau, follow the steps below:
Step 1: Drag Fuel Type and City Mpg Ft1 to the Rows and Columns section as applicable.
Step 2: Click on the sort order icon to sort in descending order.
Step 3: Drag Fuel Type 1 to the Filter shelf. In the Filter window, navigate to the Wildcard tab and put conditions in place to filter the keyword containing Gasoline.
It will create Dimension Filter for your visualization, as shown below.
Example #5 – Measure Filter
In this example, we will demonstrate creating a measure filter using the World’s Largest Empires by Area dataset. The World’s Largest Empires by Area dataset contains details on Empires, Maximum land area, and Year of their rulings.
To create a Measure filter using this dataset, follow the steps outlined below:
Step 1: Navigate to File and select the Open option. Use the file navigator to import the dataset.
Step 2: In the new worksheet, drag the Empire dimension to the Rows section and the Maximum Land area (million sq mi) to the Columns section.
Step 3: Sort the visual by clicking on the sort icon.
Step 4: Drag the measure i.e. Maximum Land area (million sq mi) to the Filters shelf.
Step 5: Select the At least option and specify the value as 3. Click on the Apply button.
This will create a measure filter as shown below.
Example #6 – User Filter
To demonstrate the concentric donut chart in tableau, we have used the Numberofinternetusers dataset. This dataset contains internet users across different countries.
To create this chart, follow the steps outlined below:
Step 1: Import the Numberofinternetusers dataset to Tableau.
Step 2: In the new worksheet, drag the Entity to the Rows and Number of Internet Users to the Columns section.
Step 3: Navigate to the Server tab – Create User Filter – Select the field (Entity)
Step 4: Log in to your Tableau server with credentials.
Step 5: In the User Filter box, provide a name and specify the filter for your user group.
Important Things to Note
- Understanding the order of operation in Tableau may be helpful for you to manipulate the outcomes.
- Be careful with context filters as they impact the other filters such as dimension filters and are more global in terms of scope.
- There are lots of cross-dependencies with different filters in Tableau that impact the behavior.
- While you can apply filters using the Filters shelf, you can also display them as cards allowing you to run variations to display the desired result.
- While filters narrow down the dataset, it may affect the overall performance as well. Use these filters consciously per your data requirements.
Frequently Asked Questions (FAQs)
While you can’t control the order of operations when using filters in Tableau as this is Tableau’s internal algorithm, you can only influence it partially. Here’s how to do it:
• When it comes to the initial filtering, Tableau follows the Extract Filter followed by the Tableau filter data source. However, you can redefine them on the Data Source tab to apply a filter to your dataset.
• Similarly, you can also convert a dimension filter to a context filter.
To create interactive filters for your Tableau filter dashboard, follow the steps below:
• Display interactive filters for your data visualization
• Define the options for filter card interaction and visualization
• Use Filter cards and customize for your requirements
Multiple advanced filtering techniques in Tableau include:
• Selection of keep or exclude data points in the visualization
• Use of Wildcard, conditions, or Top N results
• Selection of a range of values, At Least, At most, or Special (custom)
• Filter of Relative Dates, a range of dates, Discrete dates, Latest Date preset, individual dates, or additional date options.
To ensure consistent filtering across multiple Tableau filter dashboards, you may follow the below best practices:
• Use of Global Filters by setting up the filter and applying it to all the worksheets
• Use Global Parameters to define the action and create standardization
• Use of dashboard action to sync multiple filters across different worksheets.
Recommended Articles
This has been a guide to Tableau Filters. Here we explain different types of filters used in Tableau and how to use them with examples & points to remember. You can learn more from the following articles –
Leave a Reply