<!-- https://learnsql.cpetoday.com/functions/m/date-quarterofyear -->
# Date.QuarterOfYear

Language: Power Query M
Category: Date
Syntax: Date.QuarterOfYear(dateTime as any) as nullable number
Summary: Returns the calendar quarter of a date, from 1 for January to March through 4 for October to December.
Returns: The quarter as a number from 1 to 4, or null when the input is null.
Level: Beginner
Related: Date.StartOfQuarter, Date.EndOfQuarter, Date.Year, Date.Month, Date.AddMonths

## What it does
Date.QuarterOfYear returns the calendar quarter of a date. It is the basis of quarterly reports, quarter labels and quarter end checks. The quarters follow the calendar, so January to March is quarter 1. A fiscal calendar that starts in another month needs an offset, which the fiscal quarter example shows.
## Syntax and arguments
- dateTime: a date or a datetime value.
## Example
A quarterly board pack needs a label such as "Q4 2026" for the period in which a set of invoices was billed.

```powerquery
let
    Billed = #table(type table [InvoiceDate = date, Amount = number],
        {{#date(2026, 2, 14), 400}, {#date(2026, 10, 29), 900}}),
    Labeled = Table.AddColumn(Billed, "Quarter", each
        "Q" & Text.From(Date.QuarterOfYear([InvoiceDate])) & " " & Text.From(Date.Year([InvoiceDate])),
        type text)
in
    Labeled
```

The February invoice is labeled "Q1 2026" and the October invoice is labeled "Q4 2026". The label is built from two numbers, so it is the same on every machine.
## Example: a second, different use
Get a fiscal quarter for a company whose fiscal year starts in July. Shift the date forward six months first, then take the quarter: October 29, 2026 becomes April 2027, which is quarter 2 of the fiscal year.
## Things to watch
- The quarter is the calendar quarter. Fiscal quarters need the offset shown above.
- A quarter label needs the year too. Q1 2026 and Q1 2027 are different periods.
- The result is a number. Use Text.From before you join it to a text label.
- Null in gives null out.
## In business terms
Quarterly close, quarterly tax filings and board reporting are all organized by quarter. A consistent quarter label is what lets a controller compare the same quarter across years without a separate lookup table.
