Date.AddYears

Updated on

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

Date.AddYears adds a specified number of years (numberOfYears) to a date, datetime, or datetimezone value (dateTime).

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 Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-addyears