AddYears (PQL)

Returns a new date-time with the number of years added

Syntax

AddYears( <Column DateTime> , <Integer> )

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

Comments
  • The column needs to be an attribute with date-time values in the model. (The data type needs to be 'date-time')
  • Use a positive integer to count years forward from each date in the column, in order to return a dates after the original date.
  • Use negative integers to return a specified year prior to each date in the column.
  • For details on how to employ and use this function see the custom column overview.
Different Function types
  • This function is similar to the PQL semantic and common functions of the same name. However, it operates on a column directly at the grain.
  • As a granular function, it is used in the base SQL query itself.

Examples

This example adds 1 years to each date in the Order Date column.

AddYears( [Data].[OrderDate], 1 )

If the figure had been set to "-1" the result would reduce 1 year from each date in the column.

You can see the effect from this example snippet in column #8, based on the original date column in position #1.