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.
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.
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.
Anchor to SINCE and UNTILSINCE and UNTIL
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 SINCESINCESINCESINCE <date_offset>SINCE <date_offset>
Sets the starting date or date-time for the query range.
- Anchor to UNTILUNTILUNTILUNTIL <date_offset>UNTIL <date_offset>
Sets the ending date or date-time for the query range.
Anchor to DURINGDURING
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.
Anchor to Absolute datesAbsolute dates
Use absolute dates and absolute date-time values as date parameters. Date parameters aren't wrapped in quotes.
| Date format | Syntax | Description |
|---|---|---|
| absolute date | yyyy-MM-dd | A specific date. |
| absolute date-time | | A specific date and time. |
Anchor to Relative datesRelative dates
Use relative offsets with an optional sign, a whole number, and a supported unit.
| Date format | Syntax | Description |
|---|---|---|
| seconds | [-]<number>s | Number of seconds from query time. |
| minutes | [-]<number>min | Number of minutes from query time. |
| hours | [-]<number>h | Number of hours from query time. |
| days | [-]<number>d | Number of calendar days from query time. |
| weeks | [-]<number>w | Number of calendar weeks from query time. |
| months | [-]<number>m | Number of calendar months from query time. |
| quarters | [-]<number>q | Number of calendar quarters from query time. |
| years | [-]<number>y | Number of calendar years from query time. |
Anchor to Named date rangesNamed date ranges
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 range | Description |
|---|---|
now | The date and time that the query runs. |
today | The day that the query runs. |
yesterday | The previous 24-hour period from query time. |
| The current calendar week. |
| The current weekend. |
| The previous weekend. |
| The current calendar month. |
| The current calendar quarter. |
| The current calendar year. |
| The previous calendar week. |
| The previous calendar month. |
| The previous calendar quarter. |
| The previous calendar year. |
bfcm2020, bfcm2021, ... | The BFCM range for the specified year. |
Anchor to Date functionsDate functions
Use date functions to align a relative offset with the start or end of its matching time unit. Use functions with SINCE and functions with UNTIL. The function's time unit must match the relative offset unit.
| Time unit | Functions | Description |
|---|---|---|
| minute | | Truncates to the beginning or end of the target minute. |
| hour | | Truncates to the beginning or end of the target hour. |
| day | | Truncates to the beginning or end of the target day. |
| week | | Truncates to the beginning or end of the target week. |
| month | | Truncates to the beginning or end of the target month. |
| quarter | | Truncates to the beginning or end of the target quarter. |
| year | | Truncates to the beginning or end of the target year. |