SQL Current Quarter
Same pattern as current month, one level wider — DATE_TRUNC('quarter', ...) instead of 'month'.
What & Why
A quarter filter starts at a quarter boundary and ends just before the next one. The worked campaign result uses the fixed Q1 2024 range from January 1 through April 1.
See How It Works
BUSINESS QUESTION
Using 2024-03-31 as the report date, Marketing wants campaigns that started during Q1 2024.
| id | name | channel | spend | start_date | end_date | status | target_segment |
|---|---|---|---|---|---|---|---|
| 1 | Spring Launch | google_ads | 55000.00 | 2024-01-15 | 2024-03-31 | active | smb |
| 2 | Retention Webinar | 45000.00 | 2024-02-10 | 2024-04-15 | active | enterprise | |
| 3 | Finance Retargeting | 50000.00 | 2024-03-12 | 2024-05-31 | active | enterprise | |
| 4 | Enterprise Search | google_ads | 60000.00 | 2024-04-01 | 2024-06-30 | active | enterprise |
EXAMPLE QUERY
SELECT
id AS campaign_id,
name,
start_date
FROM marketing.campaigns
WHERE start_date >= DATE '2024-01-01'
AND start_date < DATE '2024-04-01'
ORDER BY start_date, campaign_id;RESULT — exact output from the displayed Queryflo rows
| campaign_id | name | start_date |
|---|---|---|
| 1 | Spring Launch | 2024-01-15 |
| 2 | Retention Webinar | 2024-02-10 |
| 3 | Finance Retargeting | 2024-03-12 |
The fixed Q1 boundaries include the January, February, and March campaigns.
Sign up free to try it on a real business scenario