Filter Data from Your Views
Filtering is an essential part of analysing data. This article describes the many ways you can filter data from your view. It also describes how you can display interactive filters in the view, and format filters in the view.
Filtering Order of Operations
Before you begin filtering data in Tableau, it's important to understand the order in which Tableau executes filters in your workbook.
Tableau performs actions on your view in a very specific order; this is called the Order of Operations. Filters are executed in the following order:
- Extract filters
- Data source filters
- Context filters
- Filters on dimensions (whether on the Filters shelf or in filter cards in the view)
- Filters on measures (whether on the Filters shelf or in filter cards in the view)
To learn more, see Tableau's Order of Operations(Link opens in a new window).
Note: When you drag a discrete dimension to the Filters shelf, the Filter dialog box offers four tabs for filtering: General, Wildcard, Condition and Top. The settings on each of these tabs are additive starting with the General tab; what you set on each tab will affect the filter results on each tab to the right. For details on the Filter dialog box, see Drag dimensions, measures and date fields to the Filters shelf and Filter categorical data (dimensions).
Select to keep or exclude data points in your view
You can filter individual data points (marks), or a selection of data points from your view. For example, if you have a scatter plot with outliers, you can exclude them from the view so you can better focus on the rest of the data.
To filter marks from the view, select a single mark (data point) or click and drag in the view to select several marks. On the tooltip that appears, you can:
Select Keep Only to keep only the selected marks in the view.
Select Exclude to remove the selected marks from the view.
Note: These filtering options are not available if a Wildcard Match filter is already specified for the same field. See Drag dimensions, measures and date fields to the Filters shelf(Link opens in a new window) to learn more about Wildcard Match filters.
Select headers to filter data
You can also select headers to filter them from your view.
To filter entire rows or columns of data from your view, select the header in the view. On the tooltip that appears, select to Exclude or Keep Only the selected data.
When you select a table header that is part of a hierarchy, all of the next level headers are also selected. For example, the view shown below consists of two unrelated dimensions placed on the Columns shelf, and two levels of the same hierarchy placed on the Rows shelf.
The selected row headers include the Furniture member of the Category dimension, and the Binders and Labels members of the Sub-category dimension. When Furniture is selected, all members from the next (inner) level in the hierarchy are automatically selected. In this case, that means the Bookcases, Chairs, Furnishings and Tables members.
Drag dimensions, measures and date fields to the Filters shelf
Another way to create a filter is to drag a field directly from the Data pane to the Filters shelf.
When you add a field to the Filters shelf, the Filter dialog box opens so you can define the filter. The Filter dialog box differs depending on whether you are filtering categorical data (dimensions), quantitative data (measures) or date fields.
Filter categorical data (dimensions)
Dimensions contain discrete categorical data, so filtering this type of field generally involves selecting the values to include or exclude.
When you drag a dimension from the Data pane to the Filters shelf in Tableau Desktop, the following Filter dialog box appears:
General: Use the General tab to select the values you want to include or exclude.
Wildcard: Use the Wildcard tab to define a pattern to filter on. For example, when filtering on email addresses you might want to only include emails from a specific domain. You can define a wildcard filter that ends with ‘@gmail.com’ to only include Google email addresses.
Condition: Use the Condition tab in the Filter dialog box to define rules to filter by. For example, in a view showing the average Unit Price for a collection of products, you may want to only show the Products that have an average unit price that is greater than or equal to £25. You can use the built-in controls to write a condition or you can write a custom formula.
Top: Use the Top tab in the Filter dialog box to define a formula that computes the data that will be included in the view. For example, in a view that shows the average Time to Ship for a collection of products, you can decide to only show the top 15 (or bottom) products by Sales. Rather than having to define a specific range for Sales (e.g. greater than $100,000), you can define a limit (top 15) that is relative to the other members in the field (products).
Important Note: Each tab adds additional definitions to your filter. For example, you can select to exclude values under the General tab, and also add limits under the Top tab. Selections and configurations from both tabs are applied to your filter.
At any time, you can see the definitions of your filter under Summary on the General tab.
Filter quantitative data (measures)
Measures contain quantitative data, so filtering this type of field generally involves selecting a range of values that you want to include.
When you drag a measure from the Data pane to the Filters shelf in Tableau Desktop, the following dialog box appears:
Select how you want to aggregate the field, and then click Next.
In the subsequent dialog box, you're given the option to create four types of quantitative filters:
Range of Values: Select the Range of Values option to specify the minimum and maximum values of the range to include in the view. The values you specify are included in the range.
At Least: Select the At Least option to include all values that are greater than or equal to a specified minimum value. This type of filter is useful when the data changes often, therefore specifying an upper limit may not be possible.
At Most: Select the At Most option to include all values that are less than or equal to a specified maximum value. This type of filter is useful when the data changes often, therefore specifying a lower limit may not be possible.
Special: Select the Special option to filter on Null values. Include only Null values, Non-null values or All Values.
Note: If you have a large data source, filtering measures can lead to a significant degradation in performance. It is sometimes much more efficient to filter by creating a set containing the measure and then apply a filter to the set. For more information about creating sets, see Create Sets(Link opens in a new window).
Filter dates
When you drag a date field from the Data pane to the Filters shelf in Tableau Desktop, the following Filter Field dialog box appears:
You can select whether you want to filter on a relative date; filter between a range of dates; or select discrete dates or individual dates to filter from the view.
Filter relative dates: Click Relative dates to define a range of dates that updates, based on the date and time you open the view. For example, you may want to see Year to Date sales, all records from the past 30 days, or bugs closed last week. Relative date filters can also be relative to a specific anchor date rather than today.
Filter a range of dates: Select Range of dates to define a fixed range of dates to filter. For example, you may want to see all orders placed between 1 March 2009 and 12 June 2009.
Filter discrete dates: Select a discrete date value in the dialog box if you want to include entire date levels. For example, if you select Quarters, you can choose to filter specific quarters (e.g. Q1, Q2, Q3, Q4) from your view, regardless of the year.
Latest date preset: If you want to ensure that only the most recent date in a data source is selected in the filter when the workbook is shared or opened, select a discrete date such as Month/Day/Year or Individual Dates and then, on the General tab, select Filter to latest date value when workbook is opened.
Notes: When you filter to the latest date value, this setting applies only to data source filters in a workbook.
In the order of operations, the latest date filter is global to the workbook, while context filters apply per worksheet. The latest date is determined just after the workbook opens for first use, after data source filters, but before context filters. At that point the date is set, and the latest date preset is used as a dimension filter.
If you are using additional filters in views (including relative date filters and context filters), the latest date value setting may result in an empty view with no data when those additional filters do not select data from the latest date in the database.
On Tableau Server and Tableau Cloud, presets are applied when the view first loads in the browser but not when the browser or data is refreshed.Filter individual dates: Select Individual dates to filter specific dates from your view.
Additional date filter options: When you select Relative dates or Range of dates, the Filter dialog box opens. In that dialog box, you can define a Starting date or Ending date. You can also select Special to include null dates, non-null dates or all dates.
Filter table calculations
To create a table calculation filter, create a calculated field, and then place that field on the Filters shelf.
Filters based on table calculations do not filter out underlying data in the data set, because table calculation filters are applied last in the order of operations. This means Tableau evaluates any table calculations in the view first, and then applies table calculation filters on the results in the current view.
Apply table calculation filter to totals
When you show totals in a view and you want a table calculation filter to apply to the totals, you can select Apply to totals in the drop-down menu for that filter (on the Filters shelf). This option lets you decide when a table calculation filter should be applied to totals.
This options is available when you show totals in the view, and you add a table calculation filter to the view. Select Apply to totals to apply the table calculation filter to all of the results in the table, including the totals.
Display interactive filters in the view
When an interactive filter is shown, you can quickly include or exclude data in the view.
Note: In web authoring, interactive filters are automatically added to the view when you drag a field to the Filters shelf.
To show a filter in the view:
- In the view, click the field drop-down menu and select Show Filter.
The field is automatically added to the Filters shelf (if it is not already being filtered), and a filter card appears in the view. Interact with the card to filter your data.
Note: In Tableau Desktop, you can add an interactive filter to the view for a field that is not currently used in the view. To do so, In the Data pane, click the field drop-down menu, and then select Show Filter.
Set options for filter card interaction and appearance
After you show a filter, there are many different options that let you control how the filter works and appears. You can access these options by clicking the drop-down menu in the upper right corner of the filter card in the view.
Some options are available for all types of filters, and others depend on whether you’re filtering a categorical field (dimension) or a quantitative field (measure).
You can customise how filters appear in the view, in dashboards or when published to Tableau Server or Tableau Cloud.
Here are some of the general filter card options:
Edit Filter - This option opens the main Filter dialog box so you can further refine the filter by adding conditions and limits.
Remove Filter - Removes the filter from the Filters shelf and removes the filter card from the view.
Apply to worksheets - Allows you to specify whether the filter should apply to only the current worksheet or be shared across multiple worksheets. For more information, see Apply Filters to Multiple Worksheets.
Format Filters (Tableau Desktop only) - Customise the font and colours of all your filter cards in the view.
Only relevant values - Specifies which values to show in the filter. When you select this option other filters are considered and only values that pass these filters are shown. For example, a filter on State will only show the Eastern states when a filter on Region is set. You can use the toggle at the top of the filter card to switch between this option and the All Values in Database option.
All values in hierarchy - Specifies which values to show in the filter. When you create a filter from a hierarchical field, this option is selected by default. Filter values are displayed based on relevance of the parent/child relationships in the hierarchy.
All values in database - Specifies which values to show in the filter. When you select this option all values in the database are shown regardless of the other filters on the view.
All values in context (Tableau Desktop only) - When one of the filters in the view is a context filter, select this option on a different filter to only display values that pass through the context filter. For more information, see Use Context Filters.
Include values - When this option is selected, the selections in the filter card are included in the view.
Exclude values - When this option is selected, the selections in the filter card are excluded from the view.
Hide Card (Tableau Desktop only) - Hides the filter card but does not remove the filter from the Filters shelf.
Filter card modes
You can control the appearance and interaction of your filter card in the view by selecting a filter card mode.
To select a filter card mode, in the view, click the drop-down menu on the filter card and then select a mode from the list.
The types of filter card modes you see in the list of options depend on whether your filter is on a dimension or a measure. Below you can find brief descriptions of the types of filter card modes available for dimensions and measures.
For dimensions, you can choose from the following filter modes:
Single Value (List): Displays the values of the filter as a list of radio buttons where only a single value can be selected at a time.
Single Value (Dropdown): Displays the values of the filter in a drop-down list where only a single value can be selected at a time.
Single Value (Slider): Displays the values of the filter along the range of a slider. Only a single value can be selected at a time. This option is useful for dimensions that have an implicit order such as dates.
Multiple Values (List): Displays the values in the filter as a list of check boxes where multiple values can be selected.
Multiple Values(Dropdown): Displays the values of the filter in a drop-down list where multiple values can be selected.
Multiple Values (Custom List): Displays a text box where you can type a few characters and search for the value. Alternatively, you can type or paste a list of values into the text box to create a custom list of values to include.
Wildcard Match: Displays a text box where you can type a few characters. All values that match those characters are automatically selected. You can use the asterisk character as a wildcard character. For example, you can type ‘tab*’ to select all values that begin with the letters ‘tab’. Pattern Match is not case sensitive. If you are using a multidimensional data source, this option is only available when filtering single level hierarchies and attributes.
For measures, you can choose from the following filter modes:
Range of Values/Dates: shows the filtered values as a pair of sliders that you can adjust to include or exclude more values. Click on the upper and lower limit readouts to enter the values manually.
The darker area inside the slider range is called the data bar. It indicates the range in which data points actually lie in the view. Use this indicator to determine a filter that makes sense for the data in your data source. For example, you may filter the Sales field to only include values between £200,000 and £500,000 but your view only contains values between £250,000 and £320,000. The range of data you can see in the view is indicated by the data bar while the sliders show you the range of the filter.
Note: Data bars only show in filters where the filtered field is also used in the view (e.g., on Columns, Rows or on the Marks card, and so on) and are at the same aggregation level as the field on the Filters shelf. For example, a filter on SUM(Sales) will only display data bars if the SUM(Sales) field is used in the view. It won't show if AVG(Sales) is used in the view. Even though in both scenarios, the filtered field, Sales is used in the view; in the latter case the aggregation is different than the aggregation of the filter.
At Least/Starting Date: shows a single slider with a fixed minimum value. Use this option to create a filter using an open ended range.
At Most/Ending Date: shows a slider with a fixed maximum value. Use this option to create a filter using an open ended range.
Relative to Now: this option shows a control where you can define a dynamic date range that updates based on when you open the view. The option is only available for filters on continuous date fields.
Browse periods: shows common date ranges such as past day, week, month, three months, one year and five years. This option is only available for filters on continuous date fields.
Note: When you expose a filter for Measure Values or Measure Names as a single value list, selecting All will automatically convert the filter to a multiple values list. For information on Measure Values and Measure Names, see Measure Values and Measure Names.
Customise filter cards
In addition to the general filter options and the filter modes, you control how your filter appears in the worksheet, on dashboards or when published to the web even further in Tableau Desktop.
To customise filters, click the filter card drop-down menu and select Customise.
You can select from the following options:
Show ‘All’ Value - toggles whether to show the ‘All’ option that displays by default in multiple values and single value lists.
Show Search Button - toggles whether to show the search button at the top of the filter.
Show Include/Exclude - toggles whether to show the Include Values and Exclude Values commands on the filter card menu. When shown, users can switch the filter between include and exclude modes.
Show Control Types - Toggles whether to let users change the type of quick filter shown. For example, when shown, a user can change a multiple values list to a compact list.
Show More/Fewer button - toggles whether to show the More/Fewer button at the top of the filter.
Show All Values button - toggles whether to display the Show All Values button on the filter card.
Whenever data is excluded in the filter, the small red ‘x’ appears on the Show All Values button. When all values are showing, the red ‘x’ disappears.
Show Apply Button - toggles whether to show the Apply button at the bottom of the filter. When shown, changes to the filter are only applied after you click the button. Pending changes are indicated with a green colour. This option is only available in multiple values lists and dropdowns. This options is available in web authoring.
Show Readouts - controls whether the minimum and maximum values are displayed as text above a range of values. The readouts can be used to manually type a new value instead of using the sliders.
Show Slider - controls whether the slider displays. When this option is cleared, the filter only displays the readouts.
Show Null Controls - shows a drop-down list that lets you control how the filter handles null values. You can select from values in a range; values in a range and null values; null values only, non-null values or all values.
Note: Not all of the above options are available for views published to Tableau Server or Tableau Cloud.