Date.StartOfYear
DateReturns the first day of the year for a given date.
Syntax
Date.StartOfYear(dateTime as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | The date, datetime, or datetimezone value to find the start of the year for. |
Return Value
any — The first day of the year containing the input date.
Remarks
Date.StartOfYear returns January 1 of the year for the given date, datetime, or datetimezone value. The return type matches the input type. If the input is null, the function returns null.
Examples
Example 1: Find the start of year for each hire date
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(Employees, 4),
{"FullName", "HireDate"}
),
"YearStart", each Date.StartOfYear([HireDate]), type date
)Result
FullName | HireDate | YearStart | |
|---|---|---|---|
| 1 | John Smith | 3/15/2021 | 1/1/2021 |
| 2 | Sara Johnson | 7/1/2019 | 1/1/2019 |
| 3 | Mike Davis | 1/10/2022 | 1/1/2022 |
| 4 | Emily Chen | 6/20/2023 | 1/1/2023 |
Example 2: Start of year from a scalar value
#table(
type table [Date = date, StartOfYear = date],
{{#date(2024, 4, 15), Date.StartOfYear(#date(2024, 4, 15))}}
)Result
Date | StartOfYear | |
|---|---|---|
| 1 | 4/15/2024 | 1/1/2024 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks