Filtering
Filters are rules that define which records should be excluded from a Semantic Query. Filters cover both native dimensions and measurements sources from DMOs/DLOs/CIs as well as Calculated Fields. The following filtering settings are supported:
- Dates:
- Custom date range (from X to Y)
- Operators date filters (between, less than or equal to, greater than or equal to, is null, is not null)
- Filter by Relative date: The query generator receives a relative date filter and returns the relevant records
- Filter by text-type fields with the following operators: equals, not equal to, does not contain ,contains , starts with, is null, is not null
- Filter by num-type fields with the following operators: equals, not equal to, greater than, less than, greater or equal, less or equal, is null is not null, between
- Filter logic between multiple filters using AND, OR, NOT, parenthesis
Example: You can use a filter to filter out irrelevant regions and time periods (i.e. before 2020) when calculating the ACV in a specific region during a specific time period.
Filters within Semantic Models usually exist within the context of another object.
The following are examples of how to use a filter in a Semantic Query with various objects within Tableau Semantics:
Context filters are data filters that are applied before any other filters in the query, with the exception of Semantic Data Model filters which are applied on the data model first. All other filters applied to the query will process the data that passes through the context filter. A context filter can be thought of as an independent filter, with all other filters being dependent on the context filter.
Flatten filters are data filters that are composed of several other filters, combined by using logical operators (AND, OR).
Aggregate filters are data filters that are applied on the result of an aggregation function, such as sum or max.
Relative date filters allow you to filter data based on dynamic date ranges that are calculated relative to a specified anchor date. The relativeDateRange object defines a time period using date parts and offset values to create flexible date ranges that automatically adjust based on the current date or a specified anchor date. Supported datePart values include: Minute, Hour, Day, Week, Month, Quarter, Year, Fiscal_Week, Fiscal_Month, Fiscal_Quarter, Fiscal_Year, and Localized_Week.