Filter Data from Data Sources
You can create filters on a data source, thereby reducing the amount of data in the data source.
Data source filters can be useful for restricting the data users can see when you publish a workbook or data source. When you publish a data source to Tableau Cloud or Tableau Server, the data source and any relevant files and extracts are moved to the Server or Cloud site. Publishing a data source lets you set permissions on the data, such as who can see it, connect to it, download it, or use it to create analyses.
Users who create analyses from the published data source can't see or modify any data source filters used to build that published data source, but all of the data they query will have those filters applied. This is a great way to offer a restricted subset of your data, for example by filtering dimensions for specific users and groups, or by defining data source filters based on a fixed or relative date range. This is often useful for data security, and it also allows you to manage data performance. For systems that rely heavily on partitions or indexing, data source filters may yield tremendous control over the performance of queries issued by Tableau.
Types of data source filters
Data source filters
There are two kinds of data source filters, pervasive and per table. Prior to 2025.1, a data source filter filters the table where it was applied and that filtering carries through to all related tables. In effect, the filter is applied to the entire tree of related tables. Using the Scope setting, you can control how broadly the filter is applied. <Table> and all related tables retains the default behavior of filtering all related data. Setting the scope to the single table makes it a per table filter that only filters that specific table, also known as a logical table filter. Using a logical table filter is similar to filtering the table before connecting it to the rest of the tables in the data source. Scoping the data source filter to a logical table replaces the need to use custom SQL to restrict a filter to one table.
Extract filters
An additional filter can be set on data sources that are extracted rather than live. Extract filters limit the data that is pulled into the extract. Whether an extract filter is per-table or pervasive depends on the structure of the data model.
- If the data source contains a single base table, extract filters are pervasive. This is the historical behavior of extract filters.
- If the data model contains multiple base tables and uses multi-fact relationships, extract filters are necessarily applied only to a single table as logical table filters. This is the default for multi-fact relationships.
If you create an extract from a data source that already has data source filters in place, those existing filters are automatically recommended as extract filters and appear in the Extract dialog. Those recommended filters aren't required in the Extract filter list and can safely be removed without altering the existing set of data source filters.
Create a data source filter
- Add the filter:
- On the data source page: select Add in the Filters section in the upper-right corner of the page.
- From the authoring environment: right-click (control-click on a Mac) the data source at the top of the Data Pane to open its context menu, then choose Edit Data Source Filters….
Whether you start from the Data Source page or from a worksheet, the Edit Data Source Filter dialog appears, listing any existing data source filters.
- On the data source page: select Add in the Filters section in the upper-right corner of the page.
- Select Add to open an Add Filter dialog box listing all fields in the data source, nested in their logical tables.
- Select a field to filter; then specify how the field should be filtered, just as you would for a field on the Filters shelf, and select OK.
- Set the scope:
- TableName to filter only the active table. This scope makes the filter a logical table filter that doesn't impact the entire data source
- TableName and related tables to filter the active table and all tables it is related to. This is the same pervasive filter behavior as found in previous versions.
To add an additional data source filter, repeat the process.
In some situations, a filter may be present that can't be scoped to a single logical table filter. This can happen when the filter is created on a calculated field that references fields from multiple tables, or if the filter refers to a field from another table. Filtering in those conditions must be for the table and related tables, not scoped to a single logical table.
Global filters and data source filters
When you create a data source filter, any global filters that use that data source are displayed automatically in the Edit Data Source Filters dialog box.
In Tableau Desktop, you can promote a global filter to be a data source filter. To promote the global filter to be a data source filter, click OK.
If you promote a global filter to be a data source filter in Tableau Desktop, that global filter will no longer be visible in worksheets of the workbook (because it becomes a data source filter).
Important: Be aware that you do not need to select a global filter in the Edit Data Source Filters dialog box to promote it. When you click OK, all global filters in the list will be promoted.
To prevent a global filter from being promoted to a data source filter, select the global filter in the Edit Data Source Filters dialog box, and then click Remove.