πŸ€–chiliad
ClaudePricing
Help CenterGAQL Lab

GAQL date ranges: DURING, BETWEEN and the predefined ranges

How to filter Google Ads queries by date, with the full list of predefined ranges and the common mistakes.

Most GAQL queries need a date filter. There are two ways to write one, both on segments.date.

Predefined ranges with DURING

SELECT campaign.name, metrics.cost_micros
FROM campaign
WHERE segments.date DURING LAST_30_DAYS

The ranges are:

  • TODAY, YESTERDAY
  • LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS
  • THIS_MONTH, LAST_MONTH
  • LAST_BUSINESS_WEEK
  • THIS_WEEK_SUN_TODAY, THIS_WEEK_MON_TODAY
  • LAST_WEEK_SUN_SAT, LAST_WEEK_MON_SUN

The "last N days" ranges end yesterday; they do not include today.

Explicit dates with BETWEEN

WHERE segments.date BETWEEN '2026-09-01' AND '2026-09-30'

Dates are written YYYY-MM-DD in quotes, and both ends are included. A single day can be written as segments.date = '2026-09-15'.

Building dates in a script

There is no predefined range for "last 90 days" or "this quarter", so build the dates:

function daysAgo(n) {
  var d = new Date();
  d.setDate(d.getDate() - n);
  return Utilities.formatDate(d, AdsApp.currentAccount().getTimeZone(), "yyyy-MM-dd");
}

var where = "segments.date BETWEEN '" + daysAgo(90) + "' AND '" + daysAgo(1) + "'";

Format dates in the account's time zone, otherwise "yesterday" can be off by a day.

Common mistakes

  • Selecting `segments.date` without filtering on it. If date is in SELECT, a date filter is required.
  • Expecting totals when date is selected. With segments.date in SELECT you get one row per day. Leave it out of SELECT, keeping the filter, to get totals for the period.
  • Including today in a performance rule. Today's data is partial and conversions are still arriving.
  • No date filter at all. Metrics then cover the account's whole history, which is rarely what you meant.

The Builder in GAQL Lab offers the predefined ranges in a dropdown.

Part of the guideGAQL Lab

More on this topic

  • What is GAQL (Google Ads Query Language)?
  • What is cost_micros in Google Ads and how do you convert it?
  • AdsApp.search() vs AdsApp.report(): which should you use?
  • AWQL vs GAQL: updating old Google Ads scripts
  • How to export Google Ads data to CSV with a query

Still stuck?

Send us a question from the help center β€” we read every message.

Ask a question
πŸ€–chiliad

The platform for managing and automating Google Ads scripts at scale. Built for PPC agencies and freelancers.

chiliad β€” Google Ads Script Management - Monitor and manage Google Ads scripts across every account | Product Hunt

Product

  • Use Cases
  • Features
  • Claude connector
  • Pricing
  • Marketplace
  • Blog
  • About
  • Roadmap
  • Changelog

Support

  • Contact Us
  • Help Center
  • Terms of Service
  • Privacy Policy

Β© 2026 chiliad. All rights reserved.