AddYears (PQL)

Returns a member that is a number of years prior to or after the specified date-time member.

  • Returned Output: Member
  • Library: PQL \ Semantic \ Date-Time
  • Version: 2018.00.000
  • Compatibility: Pyramid Query Language (PQL) data sources


AddYears( <Member> , <Integer> )

* Click on the function's arguments above for more details on the input values.

  • The member needs to be an existing member from a date-time flagged attribute in the model.
  • Use a positive integer to count years forward from the given date, in order to return a member after the given date.
  • Use a negative integer to return a member from a specified year prior to the given date.
  • For details on how to employ and use this function see the semantic calculation overview.
Different Function types
  • This function is similar the MDX lag or lead function - but is more useful being date-time aware.
  • To use a simple AddYears date-time operation on a list of dates, use the Common library function.


In this example, a negative integer is used to return a date that is 1 year prior to the date 2018-02-05:

AddYears( [data].[dateKey].[1454630400000], -1 )

The result is 2017-02-05.