EN VI

From a Vague Request to a Data Question: Metric, Grain, Window

By ··8 min read

Short answer

To turn a vague request into a data question, we fix four parts. They are the metric, the grain, the time window and the definition of who or what is counted. The same request can give 6, 7 or 8 on one table, depending on these choices. Writing them as one sentence before any SQL prevents most reports from being redone.

In earlier posts we saw that a clear question comes before any query. Now we look at how to get there. A manager rarely writes a question a table can answer. A request such as "how many active customers do we have" is short, and each word hides a choice. On a table of orders, those choices change the number, so we settle them first, in writing.

The four parts to fix

  • The metric is the number we report, such as the count of customers or the sum of revenue.
  • The grain is what one row of the result stands for, such as one customer, one order or one day.
  • The time window is the start and end dates, and whether the end date is included.
  • The definition is the rule for what counts, such as which order statuses and which customers.

One request, three answers

This is a definition problem. We run the request on a 15-row orders table, with three reasonable readings of "active in October". The first counts customers with at least one paid order in October. The second also counts cancelled orders. The third widens the window to September and October.

-- 1. paid orders in October
SELECT COUNT(DISTINCT customer_id) AS active_customers
FROM orders
WHERE status = 'paid'
  AND order_date >= '2026-10-01' AND order_date < '2026-11-01';   -- 6

-- 2. any order in October, cancelled included
SELECT COUNT(DISTINCT customer_id) AS active_customers
FROM orders
WHERE order_date >= '2026-10-01' AND order_date < '2026-11-01';   -- 7

-- 3. paid orders in September and October
SELECT COUNT(DISTINCT customer_id) AS active_customers
FROM orders
WHERE status = 'paid'
  AND order_date >= '2026-09-01' AND order_date < '2026-11-01';   -- 8
ReadingActive customers
Paid orders, October6
Any order, October7
Paid orders, September and October8

The three answers are all correct. They answer three different questions. If the manager expects 6 and the report says 8, the report looks wrong, even though nothing is broken.

Grain: count customers, not rows

Grain decides what the count stands for. In September, the paid orders give 8 rows but only 6 different customers, because two customers ordered twice. Counting rows would report 8 active customers.

-- WRONG: counts orders, not customers
SELECT COUNT(*) AS active_customers
FROM orders
WHERE status = 'paid'
  AND order_date >= '2026-09-01' AND order_date < '2026-10-01';   -- 8

-- right: counts different customers
SELECT COUNT(DISTINCT customer_id) AS active_customers
FROM orders
WHERE status = 'paid'
  AND order_date >= '2026-09-01' AND order_date < '2026-10-01';   -- 6

Write the question as one sentence

To record the four choices, we write one sentence and send it back to the person who asked. For our example, the sentence is "How many different customers placed at least one paid order between 1 October and 31 October 2026?" The answer is 6. A taxi driver does the same when he asks where exactly you are going before he starts the meter.

If the manager answers "yes, that is what I meant", we run the query. If the manager says "I also want cancelled orders", we have found the difference in a minute, before the report was built.

A short template

  1. How many (or how much) of which metric?
  2. Counted per what, such as per customer or per order?
  3. Between which dates, and is the end date included?
  4. Which rows count, and which are left out?

Frequently asked questions

How do I turn a business request into a data question?

Fix four parts, which are the metric, the grain, the time window and the definition of what counts. Write them as one sentence and confirm it with the person who asked before you write SQL.

What is grain in data analysis?

Grain is what one row of a result stands for, such as one customer, one order or one day. Counting at the wrong grain, for example rows instead of customers, gives a wrong total.

What is an active customer?

There is no single definition. Each company sets its own rule, such as at least one paid order in the last 30 days. The definition must be written down, because the count changes with it.

Keep learning, step by step.

Each lesson in Learn has a business context, a runnable example and a result check, so you practise this habit on real questions.