Date.EndOfYear
DateReturns the last day of the year for a given date.
Syntax
Date.EndOfYear(dateTime as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | The date, datetime, or datetimezone value to find the end of the year for. |
Return Value
any — The 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 | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | 12/31/2024 |
| 2 | 2 | 1/18/2024 | 12/31/2024 |
| 3 | 3 | 2/1/2024 | 12/31/2024 |
| 4 | 4 | 2/10/2024 | 12/31/2024 |
| 5 | 5 | 3/5/2024 | 12/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 | |
|---|---|---|---|
| 1 | John Smith | 3/15/2021 | 12/31/2021 |
| 2 | Sara Johnson | 7/1/2019 | 12/31/2019 |
| 3 | Mike Davis | 1/10/2022 | 12/31/2022 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks