Date.QuarterOfYear

Date

Returns the quarter of the year (1–4) for the given date.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Date.QuarterOfYear(dateTime as any) as nullable number

Parameters

NameTypeRequiredDescription
dateTimeanyYesA date, datetime, or datetimezone value.

Return Value

numberAn integer from 1 to 4 representing the calendar quarter.

Remarks

Date.QuarterOfYear returns 1 for January–March, 2 for April–June, 3 for July–September, and 4 for October–December. It is equivalent to Number.RoundUp(Date.Month(d) / 3). If the input is null, the function returns null.

This function returns a simple integer (1–4) for use as a sort key or grouping column. To get the formatted quarter label (e.g., "Q1"), concatenate with text: "Q" & Text.From(Date.QuarterOfYear([OrderDate])). For the start or end date of a quarter, use Date.StartOfQuarter and Date.EndOfQuarter.

Note that Date.QuarterOfYear always uses standard calendar quarters. If your organization uses a non-standard fiscal calendar (e.g., fiscal year starting in April), you must calculate fiscal quarters manually based on the fiscal month offset.

Examples

Example 1: Add quarter number to the Sales table

Table.AddColumn(
    Table.SelectColumns(
        Table.FirstN(Sales, 5),
        {"OrderID", "OrderDate"}
    ),
    "Quarter", each Date.QuarterOfYear([OrderDate]), Int64.Type
)
Result
OrderID
OrderDate
Quarter
111/15/20241
221/18/20241
332/1/20241
442/10/20241
553/5/20241

Example 2: Show quarter number for the first month of each quarter

#table(
    type table [Date = date, Quarter = number],
    {
        {#date(2024, 1, 1), Date.QuarterOfYear(#date(2024, 1, 1))},
        {#date(2024, 4, 1), Date.QuarterOfYear(#date(2024, 4, 1))},
        {#date(2024, 7, 1), Date.QuarterOfYear(#date(2024, 7, 1))},
        {#date(2024, 10, 1), Date.QuarterOfYear(#date(2024, 10, 1))}
    }
)
Result
Date
Quarter
11/1/20241
24/1/20242
37/1/20243
410/1/20244

Example 3: Add a formatted quarter label column

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Sales, 5), {"OrderID", "OrderDate"}),
    "QuarterLabel",
    each "Q" & Text.From(Date.QuarterOfYear([OrderDate])) & " " & Text.From(Date.Year([OrderDate])),
    type text
)
Result
OrderID
OrderDate
QuarterLabel
111/15/2024Q1 2024
221/18/2024Q1 2024
332/1/2024Q1 2024
442/10/2024Q1 2024
553/5/2024Q1 2024

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks