Back to Blog

Why Your AI's Q1 Is January When Yours Starts in April

Asked for Q1 revenue and got $80,000, which is January through March. The company's year starts in April, so Q1 is April through June and was $120,000. EXTRACT(QUARTER) only knows the calendar.

You ask: "What was Q1 revenue?" The AI says $80,000. That is January through March. The company year starts in April, so Q1 is April through June, and that quarter was $120,000.

SELECT SUM(amount)
FROM orders
WHERE EXTRACT(QUARTER FROM created_at) = 1
  AND EXTRACT(YEAR FROM created_at) = 2026

EXTRACT(QUARTER) splits the calendar year into four: January, April, July, October. Quarter 1 is always January through March. The query never asks when your year starts.

Q1 is a name, and SQL has its own

Both totals are real quarters. They are not the same three months. A fiscal year that starts in April is numbered like this:

| Name you use | Months | What SQL calls it | |---|---|---| | Q1 | April–June | quarter 2 | | Q2 | July–September | quarter 3 | | Q3 | October–December | quarter 4 | | Q4 | January–March | quarter 1 of the next calendar year |

So "Q1" in the question and EXTRACT(QUARTER) = 1 in the query only match when the year starts in January. For an April year, your Q1 is:

SELECT SUM(amount)
FROM orders
WHERE created_at >= TIMESTAMPTZ '2026-04-01'
  AND created_at <  TIMESTAMPTZ '2026-07-01'

That is $120,000. Show the dates in the answer. "Q1 (1 Apr 2026 through 30 Jun 2026)" can be checked. "Q1: $80,000" cannot.

This is not a month number that also matches every previous year. The year filter can be right and the quarter still the wrong block. It is not a week that starts on Monday. Those move a boundary by a day. This one moves the whole period by a quarter.

On December 3, "this quarter" in SQL is October through December, calendar Q4. If your Q3 is those same months, the total matches a fiscal report and the label does not. Comparing "this quarter" to "Q4" from finance is then a comparison of two different ideas that happen to share a name.

How to catch it

Ask for the first and last day, not the quarter number.

SELECT MIN(created_at) AS first_day, MAX(created_at) AS last_day
FROM orders
WHERE <the AI's filter>

If you asked for Q1 and the first day is in January, the AI used the calendar. If your year starts in April, that is the wrong quarter. Re-run with the April-to-June range and use that total.

The prompt that heads this off

Our financial year starts in April. Q1 is April through June, Q2 July
through September, Q3 October through December, Q4 January through March.
Do not use EXTRACT(QUARTER), which starts in January. Show the first and
last date of the range next to the total. If I have not told you the
start month, ask before you pick a quarter.

The short version

SQL quarters start in January. If your year starts in another month, Q1 is a different three months and EXTRACT(QUARTER) will not find it. Put the dates next to the name, and don't number a quarter until you know which month the year starts.


Read-only MCP gateway: mcpserver.design.

Related reading: