In Spotler CRM, relative date filters, called dynamic dates in the criteria builder, let you select records based on a period that moves along with time, such as this week, last month or the last 30 days, instead of a fixed date. You set a dynamic date in a rule on a date field in the criteria builder. The criteria builder is available in the Segmentation step of a report and in the criteria settings of lists and tags. Because the period is calculated again each time the criteria are used, the selection always stays up to date.
To use a relative date filter, add a rule with a date field, choose an operator, and switch the Value from a fixed date to a dynamic date. Then pick a preset period, such as This Week, or a custom number of hours, days, weeks, months or years before or after the current moment.
On this page, the following topics are covered:
- Which operators can you use for date fields?
- How do you switch between a fixed date and a dynamic date?
- How do you filter on a period like this week or last month?
- How do you filter on a rolling period like the last 30 days?
- What is the difference between During and Greater than or equal to?
- Examples of relative date filters
Which operators can you use for date fields?
Date fields in Spotler CRM have their own set of operators, which define how the criteria builder compares a date with the date or period you select. You choose the operator under Operator in a rule, after you select a date field such as a created date.
The criteria builder supports these operators for date fields:
- Equal to and Not equal to: the date matches, or does not match, the selected date or period.
- Greater than: the date is after the selected point in time.
- Greater than or equal to: the date is on or after the selected point in time.
- Less than: the date is before the selected point in time.
- Less than or equal to: the date is on or before the selected point in time.
- During and Not during: the date falls, or does not fall, within the selected period, from its start to its end.
- Between and Not between: the date falls, or does not fall, between two points in time.
- Is set and Not set: the date field has a value, or is empty.
How do you switch between a fixed date and a dynamic date?
A fixed date is one specific date that you pick in a calendar. A dynamic date is a period or a point in time relative to today, which you choose from a list. You switch between the two with the small icon in front of the Value field of a rule on a date field.
- When the Value field shows a date picker, click the calendar icon to switch to a dynamic date. Hovering over the icon shows Dynamic date.
- When the Value field shows a dropdown, click the pencil icon to switch back to a fixed date. Hovering over the icon shows Fixed date.
How do you filter on a period like this week or last month?
To filter on a period such as this week, last month or next quarter, choose a preset in the dynamic date dropdown, under Presets. Spotler CRM determines the start and end of the period automatically each time the criteria are used. Use the During operator to select all records with a date within that period.
These presets are available:
| Preset | Period it covers |
|---|---|
| Today | The current day only. |
| Yesterday | The day before today. |
| Tomorrow | The day after today. |
| This Week | From this Monday through this Sunday, including today. |
| Last Week | The full Monday to Sunday week before this week. |
| Next Week | The full Monday to Sunday week after this week. |
| This Month | From the 1st of the current month through its last day, including today. |
| Last Month | The entire previous calendar month. In October, this is all of September. |
| Next Month | The entire following calendar month. |
| This Quarter | From the start to the end of the current quarter. |
| Last Quarter | The previous full quarter. |
| Next Quarter | The following full quarter. |
| This Year | From 1 January through 31 December of the current year. |
| Last Year | The previous full calendar year. |
| Next Year | The following full calendar year. |
| This Calendar Year, Last Calendar Year, Next Calendar Year | The same as This Year, Last Year and Next Year, unless your financial year starts in another month than January. In that case, these presets follow the start month of your financial year. |
The presets follow these rules:
- Weeks always run from Monday to Sunday. This cannot be changed.
- Quarters are standard calendar quarters: January to March, April to June, July to September and October to December.
- For most Spotler CRM environments, the financial year starts in January. The Calendar Year presets then select exactly the same period as the Year presets.
How do you filter on a rolling period like the last 30 days?
A rolling period counts a number of hours, days, weeks, months or years back or forward from the current moment, for example the last 30 days. The point in time is calculated again each time the criteria are used, for example when you run the report. You set a rolling period by choosing a unit under Custom in the dynamic date dropdown.
To filter on a rolling period:
- Add a rule with a date field.
- Choose an operator, for example Greater than or equal to.
- Switch the Value to a dynamic date.
- Under Custom, select a unit: Hours, Days, Weeks, Months or Years. A plus or minus sign and a number appear.
- Choose minus to go back in time or plus to go forward, and enter the number.
For example, Greater than or equal to with minus 30 days selects all records with a date in the last 30 days. Greater than or equal to with plus 1 day selects all records with a date from tomorrow onwards.
Custom units count exactly from the current moment. Minus 1 week goes back exactly 7 days, which is different from the Last Week preset: that preset always covers the full Monday to Sunday week before this week.
What is the difference between During and Greater than or equal to?
During only selects dates within the period itself, while Greater than or equal to selects everything from the start of the period onwards, including later periods. Both operators are available in rules on date fields in the criteria builder.
For example, with the preset This Year:
- During This Year selects dates from 1 January through 31 December of this year.
- Greater than or equal to This Year selects dates from 1 January of this year, including the years after it.
- Less than or equal to This Year selects dates up to and including this year.
Examples of relative date filters
The table shows common selections and how to set them up in a rule on a date field in the criteria builder.
| You want to select records | Operator | Value |
|---|---|---|
| Created this week, from Monday to Sunday | During | This Week |
| Created last month | During | Last Month |
| Created this year, from 1 January to 31 December | During | This Year |
| Created in the current financial year, if it does not start in January | During | This Calendar Year |
| Created in the last 30 days | Greater than or equal to | Minus 30 Days |
| Created in the last 7 days | Greater than or equal to | Minus 7 Days or minus 1 Weeks |
| With a date from tomorrow onwards | Greater than or equal to | Tomorrow |
Combine relative dates with other rules
A relative date filter is a rule like any other in the criteria builder, so you can combine it with other rules, groups, sub groups and exclusions. How to structure criteria is explained in How do I build criteria with groups, rules and exclusions?