Date.StartOfQuarter
DateReturns the first day of the quarter containing the given date.
Syntax
Date.StartOfQuarter(dateTime as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A date, datetime, or datetimezone value. |
Return Value
any — A date, datetime, or datetimezone value representing the first day of the quarter.
Remarks
Date.StartOfQuarter returns the first day of the calendar quarter (Q1: January 1, Q2: April 1, Q3: July 1, Q4: October 1) that contains the given date, datetime, or datetimezone value. The return type matches the input type. This is useful for period-over-period comparisons, quarter-to-date filters, and grouping data by quarter.
Pair with Date.EndOfQuarter to construct inclusive quarter-range filters: [OrderDate] >= Date.StartOfQuarter(refDate) and [OrderDate] <= Date.EndOfQuarter(refDate). When passed a plain date, the result is also a date (unlike Date.EndOfQuarter, which returns a datetime).
For the current quarter start, use Date.StartOfQuarter(Date.From(DateTime.LocalNow())). To get the start of the prior quarter, apply Date.AddQuarters first: Date.StartOfQuarter(Date.AddQuarters(Date.From(DateTime.LocalNow()), -1)).
Examples
Example 1: Add quarter-start date to the Sales table
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(Sales, 5),
{"OrderID", "OrderDate"}
),
"QuarterStart", each Date.StartOfQuarter([OrderDate]), type date
)OrderID | OrderDate | QuarterStart | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | 1/1/2024 |
| 2 | 2 | 1/18/2024 | 1/1/2024 |
| 3 | 3 | 2/1/2024 | 1/1/2024 |
| 4 | 4 | 2/10/2024 | 1/1/2024 |
| 5 | 5 | 3/5/2024 | 1/1/2024 |
Example 2: Start of quarter for all four quarters
#table(
type table [Quarter = text, StartDate = date],
{
{"Q1", Date.StartOfQuarter(#date(2024, 2, 15))},
{"Q2", Date.StartOfQuarter(#date(2024, 5, 20))},
{"Q3", Date.StartOfQuarter(#date(2024, 8, 15))},
{"Q4", Date.StartOfQuarter(#date(2024, 11, 1))}
}
)Quarter | StartDate | |
|---|---|---|
| 1 | Q1 | 1/1/2024 |
| 2 | Q2 | 4/1/2024 |
| 3 | Q3 | 7/1/2024 |
| 4 | Q4 | 10/1/2024 |
Example 3: Filter orders for the current quarter to date
let
Today = Date.From(DateTime.LocalNow()),
QuarterStart = Date.StartOfQuarter(Today)
in
Table.SelectRows(
Sales,
each [OrderDate] >= QuarterStart and [OrderDate] <= Today
)The final output — filters the Sales table to rows where OrderDate falls from the start of the current quarter through today.
OrderID | CustomerName | Product | Category | UnitPrice | Quantity | OrderDate | Region | |
|---|---|---|---|---|---|---|---|---|
| 1 | 7 | Charlie | Gadget B | Gadgets | 50 | 3 | 4/1/2024 | West |
| 2 | 8 | Diana | Widget C | Widgets | 15 | 8 | 4/15/2024 | North |