Date.QuarterOfYear
The calendar quarter, 1 to 4, a date falls in.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Date.QuarterOfYear(dateTime as any) as nullable number
| Parameter | Type | Description |
|---|---|---|
dateTime | any | A date, datetime or datetimezone value; null gives null. |
Returns
nullable number. 1 for January to March, 2 for April to June, and so on.
Remarks
- For a fiscal year that starts in another month, move the date back by that many months first: see the second example.
Examples
An August sale
Date.QuarterOfYear(#date(2024, 8, 20))
3
The fiscal quarter, for a year that starts in July
Date.QuarterOfYear(Date.AddMonths(#date(2024, 8, 20), -6))
1
Six months back, August becomes February: the first fiscal quarter.
Related functions
Date.StartOfQuarter, Date.EndOfQuarter, Date.AddQuarters, Date.Month.