Insights Analysts can effectively utilize advanced filter expressions for date and time when conducting their program's data analyses. These expressions allow you to precisely refine your data sets, enabling more targeted and insightful reporting.
Please see below to learn more about the various date and time filter options available within an Insights Explore.
Step 1: Understand the Date & Time Filter Syntax
Familiarize yourself with the key elements of the date and time filter syntax, including the following:
- {n} is an integer (whole number).
- {interval} is a time increment such as hours, days, weeks, or months.
The phrasing you use determines whether the {interval} will include partial time periods or only complete time periods. For example, the expression 3 days includes the current, partial day as well as the prior two days. The expression 3 days ago for 3 days includes the previous three complete days and excludes the current, partial day. - {time} can specify a time formatted as either YYYY-MM-DD HH:MM:SS or YYYY/MM/DD HH:MM:SS, or a date formatted as either YYYY-MM-DD or YYYY/MM/DD. When using the form YYYY-MM-DD, be sure to include both digits for the month and day, for example, 2016-01. Truncating a month or day to a single digit is interpreted as an offset, not a date. For example, 2016-1 is interpreted as 2016 minus one year, or 2015.
Step 2: Combine Date & Time filters
Leverage the ability to combine date and time filters to achieve a complex data selection.
- To get OR logic: Type multiple conditions into the same filter, separated by commas. For example, today, 7 days ago means “today or 7 days ago”.
- To get AND logic: Type your conditions, one by one, into multiple date or time filters. For example, you could put after 2014-01-01 into a Created Date filter, then put before 2 days ago into a Created Time filter. This would mean “January 1st, 2014 and after, and before 2 days ago”.
Step 3: Review Date & Time Filter Combinations
The table below provides examples of common date and time filter expression combinations used within an Insights Explore.
Combination
|
Example
|
Notes
|
|
this {interval}
next {interval}
last {interval}
|
this day
next week
last year
|
Additional common examples: day, week, month, quarter, fiscal quarter, year, fiscal year
Note: The “day” interval cannot be used for the next or last
|
|
{n} {interval}
|
3 days
|
Includes the current day and 2 previous days
|
|
{n} {interval} ago
|
3 days ago
|
Excludes the current day, and includes the previous 3 days
|
|
before {n} {interval} ago
|
before 3 days ago
|
Includes anything that took place prior to the current day and the previous 3 days
|
|
before {time}
|
before 2018-01-01 12:00:00
|
“before” is not inclusive of the date/time you specify. The expression before 2018-01-01 will return data from all dates before 2018-01-01, but it will not return data from 2018-01-01.
|
|
after {time}
|
after 2018-10-05
|
“after” is inclusive of the date/time you specify. So, the expression after 2018-10-05 will return data from 2018-10-05 and all dates later than 2018-10-05.
|
|
{time} to {time}
|
2018-05-18 12:00:00 to
2018-05-18 14:00:00
|
The initial time value is inclusive. The latter time value is not. So the expression 2018-05-18 12:00:00 to 2018-05-18 14:00:00 will return data with the time “2018-05-18 12:00:00” through “2018-05-18 13:59:59”.
|
|
today
|
today
|
Returns data that occurred on the current day
|
|
yesterday
|
yesterday
|
Returns data that occurred on the previous day
|
|
tomorrow
|
tomorrow
|
Returns data that will occur on the next day
|
|
{n} {interval} from now
|
3 days from now
|
Returns data that occurs 3 days from the current day. For example, if today is Aug 6th, 2021, data will be returned for anything dated Aug 9th, 2021, and later.
|
|
{day of week}
|
Monday
|
Specifying a day of the week with a Dimension Group Date field returns the most recent date that matches the specified day of the week. For example, the expression Dimension Group Date matches (advanced) Monday returns the most recent Monday.
You can also use {day of week} with the before and after keywords in this context. For example, the expression Dimension Group Date matches (advanced) after Monday returns the most recent Monday and everything after the most recent Monday. The expression Dimension Group Date matches (advanced) before Monday returns every day before the most recent Monday, but it does not return the most recent Monday.
Specifying a day of the week with a Dimension Group Day of Week field returns every day that matches the specified day of the week. So the expression Dimension Group Day of Week matches (advanced) Monday returns every Monday.
|
What else do you need help with?
Not what you're looking for? Understanding Advanced Filter Expressions for Insights