Date-based filter conditions

Dates are composed of two elements: date and time. In general, when configuring a filter condition with a date field type, there are two types of conditions you can create: fixed date and relative date.

Note:

To filter features by date, the layer must support standardized SQL functions.

When filtering for dates, enter the time component in your local time zone. Behind the scenes, your dashboard will examine the target layer's properties for time zone information. If found, queries will be sent in that time zone. This may involve converting the input values to the target layer's time zone. If time zone information is not found, your dashboard will convert the input values to coordinated universal time (UTC) before being sent.

Tip:

Fixed-date conditions

Fixed-date filter conditions include a specific date value. This value can be entered by choosing a date from the date picker on the Value tab, or by choosing another date field on the Field tab. Choosing a date field works in the same way as entering a specific date value that can update based on data changes to the field.

Options for entering values for fixed date filters
Note:

The Field tab only appears if the element's layer has more than one date field.

A fixed-date filter condition can only be created with the following operators:

  • is
  • is not
  • is before
  • is or is before
  • is after
  • is or is after

Note:

It is possible to create a fixed-date filter condition with a range of fixed dates by creating individual filters with fixed dates and combining them using logical operators.

Relative-date conditions

Relative-date filter conditions include a range of date values. The range can be anchored to or include the current moment in time (that is, now), or it can be a predefined period (for example, last week). The range or anchor type you can enter depends on the operator you choose.

OperatorAnchor type

is within the last

Now

is before the last

Now

is within the next

Now

is after the next

Now

is

Predefined

is not

Predefined

is before

Predefined

is or is before

Predefined

is after

Predefined

is or is after

Predefined

Anchored to now

The benefit of using date ranges anchored to now is that they allow elements to refresh at the rate that data might be changing. For example, an indicator configured to display data that is within the last 30 minutes could potentially show different data every minute if its layer also refreshed that often. However, an indicator that shows data from yesterday will only show different data after today's date has changed (that is, after midnight) regardless of the layer's refresh interval.

When selecting an operator associated with an anchor type of now, you are prompted to specify a unit multiplier (N) as well as a time unit (for example, day, hour, minute, or second). For instance, if the date range is 7 days, the unit multiplier is 7 and the time unit is day.

Date range anchored to now
The following table describes these time units. Note that all date values are in your local time zone.

OperatorTime unitDescription

is within the last

seconds

N seconds before the current second up to now. That is, the range includes this second up until the current time.

minutes

N minutes before the current minute up to now. That is, the range includes this minute up until the current time.

hours

N hours before the current hour up to now. That is, the range includes this hour up until the current time.

days

Starts at 12:00:00 a.m. N days before the current day up to now. That is, the range includes today up until the current time.

is before the last

seconds

Starts at 12:00:00 a.m. N seconds before the current second and continues indefinitely.

minutes

Starts at 12:00:00 a.m. N minutes before the current minute and continues indefinitely.

hours

Starts at 12:00:00 a.m. N hours before the current hour and continues indefinitely.

days

Starts at 12:00:00 a.m. N days before the current day and continues indefinitely.

is within the next

seconds

Starts now and continues N seconds from now. That is, the range includes this second, after the current time.

minutes

Starts now and continues N minutes from now. That is, the range includes this minute, after the current time.

hours

Starts now and continues N hours from now. That is, the range includes this hour, after the current time.

days

Starts now and continues until 11:59:59 p.m. N days from now. That is, the range includes today, after the current time.

is after the next

seconds

Starts at 12:00:00 a.m. N seconds after the current second and continues indefinitely.

minutes

Starts at 12:00:00 a.m. N minutes after the current minute and continues indefinitely.

hours

Starts at 12:00:00 a.m. N hours after the current hour and continues indefinitely.

days

Starts at 12:00:00 a.m. N days after the current day and continues indefinitely.

Anchored to a predefined period

Using date ranges anchored to a predefined period is appropriate when you don't need data to update as frequently as the layer refreshes, which is when you want to use a date range anchored to now.

When selecting an operator associated with a predefined anchor type, you need to specify an interval on the Period tab.

Date range anchored to a predefined period

These periods are based on the following units. Note that start and end times are always based on your local time zone.

  • Day—A day starts at 12:00:00 a.m. and continues for 24 hours, ending at 11:59:59 p.m. In military time, a day starts at 00:00:00 and continues for 24 hours, ending at 23:59:59.
  • Week—A week starts at 12:00:00 a.m. on Sunday and continues for 7 consecutive days, ending at 11:59:59 p.m. on the seventh day, which is Saturday.
  • Month—A month is defined according to the Gregorian calendar. Each month starts at 12:00:00 a.m. (local time) on the first day of the month and continues until 11:59:59 p.m. (local time) on the last day of the month.
  • Quarter—Each year is divided into quarters that are three months long, as described below.
    • 1st quarter—January through March
    • 2nd quarter—April through June
    • 3rd quarter—July through September
    • 4th quarter—October through December
  • Year—A year is the 12-month time period beginning at 12:00:00 a.m. on January 1 and ending at 11:59:59 p.m. on December 31.

Predefined time periodDescription

Now

The current date and time.

Today

Starts at 12:00:00 a.m. on the current day and continues for 24 hours.

Yesterday

Starts at 12:00:00 a.m. on the day before the current day and continues for 24 hours.

Tomorrow

Starts at 12:00:00 a.m. on the day after the current day and continues for 24 hours.

This week

Starts at 12:00:00 a.m. on the first day of the current week and continues for seven days.

Last week

The 7-day period that ends immediately before the current week starts. Last week starts at 12:00:00 a.m. on the first day of the week that precedes the current week and continues for 7 days.

Next week

The 7-day period that starts immediately after the current week ends. Next week starts at 12:00:00 a.m. the first day of the week after the current week and continues for 7 days.

This month

Starts at 12:00:00 a.m. on the first day of the current month and continues until 11:59:59 p.m. on the last day of the month.

Last month

Starts at 12:00:00 a.m. on the first day of the month that precedes the current month and continues until 11:59:59 p.m. on the last day of the month.

Next month

Starts at 12:00:00 a.m. on the first day of the month that follows the current month and continues until 11:59:59 p.m. on the last day of the month.

This quarter

Starts at 12:00:00 a.m. on the first day of the current quarter and continues for three months, ending at 11:59:59 p.m. on the last day of the quarter.

Last quarter

Starts at 12:00:00 a.m. on the first day of the quarter immediately preceding the current quarter and continues for three months, ending at 11:59:59 p.m. on the last day of the quarter.

Next quarter

Starts at 12:00:00 a.m. on the first day of the quarter after the current quarter ends, and continues for three months, ending at 11:59:59 p.m. on the last day of that quarter.

This year

Starts at 12:00:00 a.m. January 1 of the current year and continues for 12 months (through 11:59:59 p.m. on December 31).

Last year

Starts at 12:00:00 a.m. January 1 of the year immediately preceding the current year and continues for 12 months (through 11:59:59 p.m. on December 31).

Next year

Starts at 12:00:00 a.m. January 1 of the year immediately following the current year and continues for 12 months (through 11:59:59 p.m. on December 31).

Year to date

Starts at 12:00:00 a.m. January 1 of the current year and continues to now. This period differs from This year because the latter can include future dates, whereas Year to date cannot.