Date.EndOfYear

Date

Returns the last 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.EndOfYear(dateTime as any) as any

Parameters

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

Return Value

anyThe last day of the year containing the input date (December 31).

Remarks

Date.EndOfYear returns December 31 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 end of year for each order date

Table.AddColumn(
    Table.SelectColumns(
        Table.FirstN(Sales, 5),
        {"OrderID", "OrderDate"}
    ),
    "YearEnd", each Date.EndOfYear([OrderDate]), type date
)
Result
OrderID
OrderDate
YearEnd
111/15/202412/31/2024
221/18/202412/31/2024
332/1/202412/31/2024
442/10/202412/31/2024
553/5/202412/31/2024

Example 2: End of year for different years

Table.AddColumn(
    Table.SelectColumns(
        Table.FirstN(Employees, 3),
        {"FullName", "HireDate"}
    ),
    "YearEnd", each Date.EndOfYear([HireDate]), type date
)
Result
FullName
HireDate
YearEnd
1John Smith3/15/202112/31/2021
2Sara Johnson7/1/201912/31/2019
3Mike Davis1/10/202212/31/2022

Compatibility

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