🤖chiliad
ClaudeТарифи
Довідковий центрGAQL 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.

Частина посібникаGAQL Lab

Більше на цю тему

  • 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

Не вдалося розібратися?

Надішліть нам запитання з довідкового центру — ми читаємо кожне повідомлення.

Поставити запитання
🤖chiliad

Платформа для керування й автоматизації скриптів Google Ads у великому масштабі. Створена для PPC-агенцій та фрилансерів.

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

Продукт

  • Сценарії використання
  • Можливості
  • Конектор Claude
  • Тарифи
  • Маркетплейс
  • Блог
  • Про нас
  • Дорожня карта
  • Журнал змін

Підтримка

  • Зв’язатися з нами
  • Довідковий центр
  • Умови користування
  • Політика конфіденційності

© 2026 chiliad. Усі права захищено.