What Is the ‘Date Expressions’ Feature? How Is It Used?

Using custom rolling date presets in the Cognetik Cloud Connector

What is the ‘Date Expression’ feature?

If you’re looking to create a dashboard that displays your data on an ongoing basis, you need to create a refreshable dashboard. 

This means that when you submit your query in the Cognetik Cloud Connector, you need to choose one of the rolling date presets provided in the drop down menu (Today, Yesterday, This Week, This Month, Two Weeks Prior, Last Week, Last 13 Weeks, Last Month, Last 13 Months, Last 7 Days, Last 30 Days, Last 90 Days, Fixed Start), as opposed to the ‘Fixed End Date’ (refreshing a dashboard with a specific end date will not update your data, as no entries beyond your end date are added). 


If these options are too limited for you, this is where the ‘Date Expressions’ feature comes in handy (available for any Data Provider supported by our Connector).


How is it used?

When choosing the ‘Start Date expression’ and ‘End Date Expression,’ the time period is determined by taking the present day as a starting point, so your limits are written as formulas. This means that the data linked to your date expression will change every day.

For example, if you want to query the last 180 days, you can choose 'Date expressions' from the ‘Preset’ drop down menu, and use this formula:

  • 'cw-2w' (current week - 2 weeks) for the ‘Start Date Expression' field
  • 'cw-1w-1d' (current week - 1 week - 1 day) for the 'End Date Expression' field


Because date ranges must be reckoned relative to the current period, the first term in an expression always begins with ‘c’.

For convenience and flexibility, we offer the possibility of using:

  • Daily variables (d, as shown in the formula above)
  • Weekly variables (w, as shown in the formula above)
  • Monthly variables (m
  • Yearly variables (y)  

In this sense, ‘cd-7d’ and ‘cd-1w’ are equivalent.

Date Expressions & Granularity

When using Date Expressions, you can choose your granularity just as you would for a standard preset or fixed dates, as the variable format (d, w, m or y) does not affect your granularity settings. These variables only help you better define your time interval. 

In order to query the new data, you need to refresh your dashboard data source (manually in Tableau desktop, or a scheduled refresh in Tableau Server) periodically.

For more info on date expressions and how to use them, visit Adobe's documentation.