Date.AddYears

Date.AddYears is a function in the Power Query M language that adds a specified number of years to a date or datetime value. The resulting value is returned as a date, datetime, or datetimezone.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Date.AddYears(
   dateTime as any,
   numberOfYears as number,
) as any

Description

Returns the date, datetime, or datetimezone result of adding numberOfYears to a datetime value dateTime.

  • dateTime: The date, datetime, or datetimezone value to which years are added.
  • numberOfYears: The number of years to add.

Examples

Add 4 years to the date, datetime, or datetimezone value representing the date 5/14/2011.

// Output: #date( 2015, 5, 14 )
Date.AddYears( #date( 2011, 5, 14 ), 4 )

Add 10 years to the date, datetime, or datetimezone value representing the date and time of 5/14/2011 08:15:22 AM.

// Output: #datetime( 2021, 5, 14, 8, 15, 22 )
Date.AddYears( #datetime( 2011, 5, 14, 8, 15, 22 ), 10 )

Other functions related to Date.AddYears are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-addyears
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.