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.

Syntax

date_range_clause:
SINCE date_parameter [UNTIL date_parameter]
UNTIL date_parameter
DURING named_date_range

date_parameter:
date_range_operator
named_date_range
date_function

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.

Examples

ShopifyQL

FROM sales
SHOW gross_sales, discounts, net_sales
SINCE 2026-01-01 UNTIL 2026-01-31

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.

Examples

ShopifyQL

FROM payments
SHOW net_payments, transactions
GROUP BY payment_method
DURING last_month
ORDER BY net_payments DESC

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.
Examples

ShopifyQL

FROM sales
SHOW net_sales, orders
TIMESERIES quarter
SINCE -4q UNTIL -1q
ORDER BY quarter ASC

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.
Examples

ShopifyQL

FROM sales
SHOW gross_sales, net_sales, orders
TIMESERIES month
DURING this_year
ORDER BY month ASC

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.
Examples

ShopifyQL

FROM sales
SHOW net_sales, orders
TIMESERIES day
SINCE startOfDay(-30d) UNTIL endOfDay(-1d)
ORDER BY day ASC

Was this page helpful?