Date.StartOfYear

Date

Returns the first day of the year for a given date.

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

Syntax

Date.StartOfYear(dateTime as any) as any

Parameters

NameTypeRequiredDescription
dateTimeanyYesThe date, datetime, or datetimezone value to find the start of the year for.

Return Value

anyThe 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
1John Smith3/15/20211/1/2021
2Sara Johnson7/1/20191/1/2019
3Mike Davis1/10/20221/1/2022
4Emily Chen6/20/20231/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
14/15/20241/1/2024

Compatibility

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