SQL Current Year

The widest of the three DATE_TRUNC-based rolling windows — everything since January 1st of this year.

What & Why

A current-year filter starts on January 1 and uses the next January 1 as its exclusive upper boundary. The worked Queryflo table fixes that range to calendar year 2024.

See How It Works

BUSINESS QUESTION

Using 2024-03-31 as the report date, Marketing wants campaigns whose start date belongs to 2024.

idnamechannelspendstart_dateend_datestatustarget_segment
1Spring Launchgoogle_ads55000.002024-01-152024-03-31activesmb
2Retention Webinaremail45000.002024-02-102024-04-15activeenterprise
3Finance Retargetinglinkedin50000.002024-03-122024-05-31activeenterprise
4Enterprise Searchgoogle_ads60000.002024-04-012024-06-30activeenterprise
EXAMPLE QUERY
SELECT
  id AS campaign_id,
  name,
  start_date
FROM marketing.campaigns
WHERE start_date >= DATE '2024-01-01'
  AND start_date < DATE '2025-01-01'
ORDER BY start_date, campaign_id;
RESULT — exact output from the displayed Queryflo rows
campaign_idnamestart_date
1Spring Launch2024-01-15
2Retention Webinar2024-02-10
3Finance Retargeting2024-03-12
4Enterprise Search2024-04-01

All displayed campaign start dates belong to the fixed 2024 year window.

Intermediate business practice

Sign up free to try it on a real business scenario