Skip to main content

SINCE, UNTIL, DURING

Use SINCE and UNTIL, or DURING, to choose one reporting period for a ShopifyQL query. Use SINCE to set an explicit start boundary, and add UNTIL to set an explicit end boundary. Use DURING for a predefined reporting period, such as last_month or bfcm2025. Because DURING already defines the full reporting period, don't combine it with SINCE or UNTIL in the same query.

For SINCE and UNTIL, date parameters can use absolute, relative, named date ranges, or date functions. To compare the selected period to another period, use COMPARE TO.

Note

When a query uses TIMESERIES, ShopifyQL returns every value of the selected time dimension across a reporting period. Use SINCE, UNTIL, or DURING to set that period explicitly. Otherwise, ShopifyQL applies default date ranges for TIMESERIES.


Use SINCE to set the inclusive start of the reporting period. Add UNTIL to set the inclusive end. If you use SINCE without UNTIL, then ShopifyQL uses now as the end date.

If you use UNTIL without SINCE, then the query must include TIMESERIES so ShopifyQL can apply a default start date. If both boundaries resolve to dates or date-times, then the UNTIL boundary can't be before the SINCE boundary.

Use explicit date boundaries when you need direct control over the reporting period. SINCE sets the inclusive start boundary, and UNTIL sets the inclusive end boundary.

Anchor to SINCE
SINCE
SINCE <date_offset>

Sets the starting date or date-time for the query range.

Anchor to UNTIL
UNTIL
UNTIL <date_offset>

Sets the ending date or date-time for the query range.


Use DURING when a named date range defines the full reporting period. DURING replaces explicit SINCE and UNTIL boundaries, so don't combine it with either clause.

DURING accepts named date ranges only and doesn't accept now. Use SINCE and UNTIL when you need now, an absolute date or date-time, a relative offset, or a date function as a boundary.


Use absolute dates and absolute date-time values as date parameters. Date parameters aren't wrapped in quotes.

Date formatSyntaxDescription
absolute dateyyyy-MM-ddA specific date.
absolute date-timeyyyy-MM-ddThh:mm:ssA specific date and time.

Use relative offsets with an optional sign, a whole number, and a supported unit.

Date formatSyntaxDescription
seconds[-]<number>sNumber of seconds from query time.
minutes[-]<number>minNumber of minutes from query time.
hours[-]<number>hNumber of hours from query time.
days[-]<number>dNumber of calendar days from query time.
weeks[-]<number>wNumber of calendar weeks from query time.
months[-]<number>mNumber of calendar months from query time.
quarters[-]<number>qNumber of calendar quarters from query time.
years[-]<number>yNumber of calendar years from query time.

To compare the selected period with a relative period such as previous_period, use COMPARE TO.

Use named date ranges for common reporting periods. SINCE and UNTIL can use named values as date boundaries. DURING uses a named date range as the whole reporting period and doesn't accept now.

Named rangeDescription
nowThe date and time that the query runs.
todayThe day that the query runs.
yesterdayThe previous 24-hour period from query time.
this_weekThe current calendar week.
this_weekendThe current weekend.
last_weekendThe previous weekend.
this_monthThe current calendar month.
this_quarterThe current calendar quarter.
this_yearThe current calendar year.
last_weekThe previous calendar week.
last_monthThe previous calendar month.
last_quarterThe previous calendar quarter.
last_yearThe previous calendar year.
bfcm2020, bfcm2021, ...The BFCM range for the specified year.

Use date functions to align a relative offset with the start or end of its matching time unit. Use startOf* functions with SINCE and endOf* functions with UNTIL. The function's time unit must match the relative offset unit.

Time unitFunctionsDescription
minutestartOfMinute(-<number>min) | endOfMinute(-<number>min)Truncates to the beginning or end of the target minute.
hourstartOfHour(-<number>h) | endOfHour(-<number>h)Truncates to the beginning or end of the target hour.
daystartOfDay(-<number>d) | endOfDay(-<number>d)Truncates to the beginning or end of the target day.
weekstartOfWeek(-<number>w) | endOfWeek(-<number>w)Truncates to the beginning or end of the target week.
monthstartOfMonth(-<number>m) | endOfMonth(-<number>m)Truncates to the beginning or end of the target month.
quarterstartOfQuarter(-<number>q) | endOfQuarter(-<number>q)Truncates to the beginning or end of the target quarter.
yearstartOfYear(-<number>y) | endOfYear(-<number>y)Truncates to the beginning or end of the target year.

Was this page helpful?