Skip to main content
Omni provides powerful, built-in options for manipulating dates on a dashboard, such as time frame switchers and period over period analysis. However, if you want to give your users even more control, templated filters are the answer. This guide walks through two advanced patterns for date flexibility:
  1. Granularity control with automated filtering: A single control that changes the granularity of time series charts (e.g., month to quarter) while simultaneously filtering to the “last complete” period.
  2. The “everything” toggles: Giving you the ability to swap the underlying date field, timeframe granularity, and date range all from a single dashboard interface using multiple filters.
Implementing these patterns allows you to create a system where you can redefine the context of your data on the fly.

Requirements

To follow the steps in this guide, you’ll need:
  • Modeler or Connection Admin permissions for the model you want to work with
  • A basic understanding of templated filters

Pattern 1: Dynamic charts with “last complete period” logic

When looking at data over time, comparing a partial current month against a full previous month can be misleading. This pattern creates a dimension that automatically nulls out the current, incomplete period based on the granularity you’ve selected.
1

Create a filter-only field for granularity

In your model, define a string filter that will act as the toggle:
2

Build the dynamic date dimension

Next, create a custom dimension using templated filters. This dimension will evaluate the user’s selection and apply the “last complete” logic.For example, when Quarter is selected, the CASE statement returns NULL for the current (incomplete) quarter and truncates to the quarter otherwise. The same pattern applies for Year and Month.Use the following code to add the dimension, replacing saas__opportunities.created_date with your own view and date field:
3

Implement on a dashboard

  1. In a workbook, select the Created Date (Completed Periods) dimension for your time series charts.
  2. Navigate to your dashboard and click Add > Filter.
  3. Configure the filter to point at your date_granularity field.
Now when the filter is used, the connected tiles will automatically update to use the selected granularity:
Date Granularity

The granularity switcher in action, automatically hiding the current incomplete period.

Pattern 2: The “everything” toggles

This pattern gives you three independent dashboard controls: the date field (e.g., switching from Created Date to Shipped Date), the granularity, and the date range window.
1

Define the selection filters

In your model, create two filter-only fields: one for the field choice and one for the granularity.
2

Create the dynamic logic

This pattern requires two dimensions to work: one to swap the raw date field, and the second to truncate that field based on the selected granularity.
The dynamic_date dimension uses a CASE statement to swap the underlying source column (for example, created_at vs. shipped_at) based on the filter selection:
3

Build the view

  1. In a workbook, build your charts using the Dynamic Date Granularity dimension.
  2. When finished, complete the following on the document’s dashboard:
    1. Add filters to the dashboard for both As of Date and Date Granularity.
    2. Add a standard date range filter and map it to the Dynamic Date Granularity field to control the window of time.
Everything Toggle

Swapping date fields, granularity, and date ranges all from the dashboard UI.

Next steps