{{# }} to open, and {{/ }} to close to dynamic sections. Inside the braces, you use the name of the object, usually of the form view.field_name.filter (the word “filter”). This will correspond to a filter_only field in the view (see examples below). Inside the pair of braces, you will include the lookup value.
Setting default values
Default values can be set using{{^ }}default_value_clause{{/ }} immediately after the existing templated filter syntax.
For example, the following would use a default filter of name like 'foo':
Examples
Any YAML parameter that expects a string must be wrapped in double quotes if the leading character has special meaning in YAML. For example,
sql: {{ view.field_name.filter }} would need to be sql: "{{ view.field_name.filter }}" to avoid validation errors.Parameterized WHERE clause in views based on a SQL query
This simple example allows a query-view to be parameterized. This example uses a filter-only field (see more on this in the dedicated section below), but can also reference a field in the view itself.filters will appear as filter-only fields in the field picker, in their own section under the measures section. These can then be used as normal filters, and the specified expression is inserted in place.

Time frame switcher
A field of dynamic granularity can be constructed such that a single filter on a dashboard swaps the granularity for multiple time series in one. By editing the .view file, it is necessary to add a dynamic dimension and a filter. In the example below, replace all references tocreated_date with the appropriate date field and order_items with the fully qualified view reference.
timeframe_selector filter can then be used either in workbooks or on dashboards across multiple tiles to update them all at once.

Conversion rates
A common analytical pattern is to compare conversion rates with 1, 3, 7, 30, or however many days. For the more static form, one might do something like this:
Dynamically filter active subscriptions using date range (SCD2)
If you have data that shows that defines the dates for the beginning of a subscription and the end of a subscription, this example allows end users the ability to filter for active subscriptions during a dynamic time frame. This utilizes Omni’s out of the box time frame selector, so some dates selections will not work well such as “On Day of Month”, but any value that is a range of dates or a specific date will return the active subscriptions during that time.Dynamically switching database table in a query
In some cases, users may need to be able to quickly switch between multiple tables when performing an analysis. For example, tables with similar data structures but differing data, such as different time grains. Note: The approach described below should be placed in a new view. You can add a view in the model IDE by clicking File > New View.Dynamically filter total count
Dynamically filter a count down to just the count for a specific value. This allows for creating visualizations where you compare the overall count to the count filtered by the dynamic value on a single visualization.
Dynamic period-over-period with custom date range
Having the ability to create custom date ranges in period over period allows for flexibility to select any date range within each period to compare values against. In the below example, there is a view file of demo real estate data where two filter-only fields have been added to create the custom date range selectors that will then be used to filter against the added measures that sum the sales_amount if the date matches the date selected in the custom filter_only field.
Filter-only fields
aliases
aliases: to the field in question pointing references from the old field name to the updated field name, restoring content and eliminating content related errors. This behaves similar to table level aliases, as shown
bind_to
WHERE clause, while filters will go into the HAVING clause.
default_filter
default_filterwill automatically populate the filter value in the templated object- This is often paired with
filter_single_select_onlyandsuggestion_listwhen a single-selection is required - For setting the filter arguments, use the filter syntax
description
- Metadata about the field, made available in the workbook/dashboard table UI upon hovering over a field with a description, or on right click from the field picker
- Omni expects unquoted text (quotes will be removed / ignored)
display_order
- Omni expects a whole number
- This will override the sort order for the field picker, inside the field’s grouping (i.e. inside a given view)
display_orderwill supersede alphabetical sorting
- For example, if the two fields above in users are given
display_order:they will float to the top of the field list in users, and the remaining fields would be sorted alphabetically - To rearrange views,
display_ordercan be used at the view level - For fields inside groups using
group_label, the group will be ranked with the min of all the fields in the group (i.e. if there are 3 fields withdisplay_orderof 4, 5 and {empty}, the group will have adisplay_orderof 4)
filter_single_select_only
- This argument will require the filter field to use a choose-one dropdown rather than the default flexible filter modal
- Recommended with templated filters that require one-and-only-one object
group_label
- This will nest a group of fields in the field picker for curated organization
- Omni expects unquoted text (quotes will be removed / ignored)
- Note measures and dimensions will still be in separate sections in the field picker under each view
- Fields can be nested under timeframes using the group label - the text rather than the field should be used (i.e.
Created Atnotcreated_at)
hidden
- Remove the field from the UI. Still referenceable in the model, but hidden in the workbook UI.
- Expects ‘true’ or ‘false’
ignored
Likely should not be used with filters, can just delete or comment out if it’s not desired in the modellabel
- Label will override the field name for all UI appearances of the field
- Omni expects unquoted text (quotes will be removed / ignored)
required_access_grants
You can also conditionally allow access by using pipes (|) and ampersands (&) to create OR and AND conditions.
suggestion_list
- Suggestion list will explicitly set the suggestions on
suggest_from_field
- This argument can be used to populate a filter with another field’s values
- Commonly used with the filter is injected in sql with a corresponding modeled field
suggest_from_topic
- This needs to be paired with
suggest_from_fieldand can tune the specific topic (ie access-filters and default filters) for a given suggestion
type
-
Currently, filter-only fields can only be defined in the IDE. They require a name, and a type. The accepted types for a filter-only field are:
booleancolumn(returns unquoted text, can be used to substitute in column names in query views)numbermost commonstringmost commontimestampmost common
view_label
- This will nest a given field under a different view than it’s default parent view, for example, grouping
user_factsfields under theusersview for better organization and discovery - Note that filters will always be below dimensions and measures
- Sometimes can be valuable to pull all filters into a separate pseudo-view, would do that with the
viewargument as seen here
Parameters
Parameters can be used in Omni in tandem with filter-only Fields. The value of a filter-only field can be referenced using the structure{{filters.table_name.field_name.value}}, and can be used in definitions for other fields. When that filter-only field is applied to a workbook or dashboard, it can be used to change the value of the parameter field, and thus interact with the query accordingly.
Consider using the filter_single_select_only argument when using a string filter-only field to parameterize some selector.
Dynamic date range example
{{filters.table_name.field_name.range_start}} and {{filters.table_name.field_name.range_end}}.
Dynamic date range comparison example
Dynamic field examples
table.field1 or table.field2 into the dynamic_dimension. For this dynamic dimension, the filter only field requires the use of type: column. Note this injects the SQL dialect’s column naming convention and will only pass SQL validation if the correct database column reference is defined for the value subparameter (e.g. in Snowflake the scoped column names would need to be capitalized).
Consider including the suggest_from_field subparameter in the filter only field to generate a list of values from the database’s metadata table.
dynamic_model specified. The filter is set as single-select, with descriptions on each model to help the end user. This value is piped into the Cortex call to select the given model for analysis using filters.states.dynamic_model.value.
Dynamic date part example
Self-referential building
We have a few handy parameters that can be leveraged in your models to build joins, dimensions, and measures based on what is present in the query. The format for calling these parameters is and they will evaluate toTRUE or FALSE:
{{ view_name.field_name.in_query }}OR{{ view_name.in_query }}{{ view_name.field_name.is_selected }}{{ view_name.field_name.is_filtered }}
in_query
This will look for the presence of a specific field OR view in the SELECT or WHERE clause of a query.is_selected
This will look for the presence of a specific field in the SELECT clause of a query.is_filtered
This will look for the presence of a specific field in the WHERE clause of a query. Example of conditional join usingin_query
is_selected

