AddMonths

Returns a member that is a number of months 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

Syntax

AddMonths( <Member> , <Integer> )

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

Comments
  • The member needs to be an existing member from a date-time flagged attribute in the model.
  • Use a positive integer to count months forward from the given date, in order to return a member after the given date.
  • Use negative integers to return a member from a specified month 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 AddMonths date-time operation on a list of dates, use the Common library function.

Examples

Adding 6 months to the date 2016-01-03 will return the date 2016-07-03:

AddMonths( [data].[dateKey].[1451779200000], 6 )

The following example uses the Range function to generate a range of dates, from 2016-01-03 to 2 months after that date:

Range( [data].[dateKey].[1451692800000] , AddMonths( [data].[dateKey].[1451692800000], 2 ) )