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.
Syntax
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.
ShopifyQL
Examples
Description
Show [`gross_sales`](/docs/api/shopifyql/latest/schemas/sales_revenue/sales#salesmetric-propertydetail-grosssales), `discounts`, and `net_sales` for January 2026. This example uses `SINCE 2026-01-01 UNTIL 2026-01-31` to set explicit start and end dates.
ShopifyQL
FROM sales SHOW gross_sales, discounts, net_sales SINCE 2026-01-01 UNTIL 2026-01-31Description
Break out [`sessions`](/docs/api/shopifyql/latest/schemas/sessions_and_behavior/sessions#sessionsmetric-propertydetail-sessions) and `conversion_rate` for each day of last month. This example uses `SINCE startOfMonth(-1m) UNTIL endOfMonth(-1m)`, which always resolves to last month as time passes.
ShopifyQL
FROM sessions SHOW sessions, conversion_rate TIMESERIES day SINCE startOfMonth(-1m) UNTIL endOfMonth(-1m) ORDER BY day ASC
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.
ShopifyQL
Examples
Description
Break down [`net_payments`](/docs/api/shopifyql/latest/schemas/finance_and_payments/payments#paymentsmetric-propertydetail-netpayments) and transactions by payment method for last month. This example uses `DURING last_month` to select a named period without spelling out the dates.
ShopifyQL
FROM payments SHOW net_payments, transactions GROUP BY payment_method DURING last_month ORDER BY net_payments DESCDescription
List [`total_sales`](/docs/api/shopifyql/latest/schemas/sales_revenue/sales#salesmetric-propertydetail-totalsales) and `orders` for each day of the 2020 BFCM weekend. This example uses `DURING bfcm2020` to select the built-in sales-event range, which resolves to the exact weekend dates.
ShopifyQL
FROM sales SHOW total_sales, orders TIMESERIES day DURING bfcm2020 ORDER BY day ASC
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. |
ShopifyQL
Examples
Description
Summarize [`net_sales`](/docs/api/shopifyql/latest/schemas/sales_revenue/sales#salesmetric-propertydetail-netsales) and `orders` by quarter from four quarters ago through one quarter ago. This example uses `SINCE -4q UNTIL -1q` to bound the window with relative offsets that shift forward each quarter.
ShopifyQL
FROM sales SHOW net_sales, orders TIMESERIES quarter SINCE -4q UNTIL -1q ORDER BY quarter ASCDescription
Track [`sessions`](/docs/api/shopifyql/latest/schemas/sessions_and_behavior/sessions#sessionsmetric-propertydetail-sessions) for each hour of the last 24 hours. This example uses `SINCE -24h UNTIL now` to bound the window down to the hour.
ShopifyQL
FROM sessions SHOW sessions TIMESERIES hour SINCE -24h UNTIL now ORDER BY hour ASC
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. |
ShopifyQL
Examples
Description
Track [`gross_sales`](/docs/api/shopifyql/latest/schemas/sales_revenue/sales#salesmetric-propertydetail-grosssales), `net_sales`, and `orders` by month for the current year. This example uses `DURING this_year` to select the year-to-date period by name.
ShopifyQL
FROM sales SHOW gross_sales, net_sales, orders TIMESERIES month DURING this_year ORDER BY month ASCDescription
Break out [`sessions`](/docs/api/shopifyql/latest/schemas/sessions_and_behavior/sessions#sessionsmetric-propertydetail-sessions) and `conversion_rate` for each hour of the current day. This example uses `DURING today` to select the current day by name.
ShopifyQL
FROM sessions SHOW sessions, conversion_rate TIMESERIES hour DURING today ORDER BY hour ASC
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. |
ShopifyQL
Examples
Description
Track [`net_sales`](/docs/api/shopifyql/latest/schemas/sales_revenue/sales#salesmetric-propertydetail-netsales) and `orders` by day from 30 days ago through yesterday. This example uses `SINCE startOfDay(-30d) UNTIL endOfDay(-1d)` to snap the boundaries to whole days, excluding today's partial data.
ShopifyQL
FROM sales SHOW net_sales, orders TIMESERIES day SINCE startOfDay(-30d) UNTIL endOfDay(-1d) ORDER BY day ASCDescription
Track [`sessions`](/docs/api/shopifyql/latest/schemas/sessions_and_behavior/sessions#sessionsmetric-propertydetail-sessions) and `conversion_rate` by month over the last three full months. This example uses `SINCE startOfMonth(-3m) UNTIL endOfMonth(-1m)` to snap the boundaries to whole months, excluding the current partial month.
ShopifyQL
FROM sessions SHOW sessions, conversion_rate TIMESERIES month SINCE startOfMonth(-3m) UNTIL endOfMonth(-1m) ORDER BY month ASC