QlikWorld 2020 Global Conference. Join us to discover how to get the most from your data. Act fast. Register now and save.

addmonths - script and chart function

This function returns the date occurring n months after startdate or, if n is negative, the date occurring n months before startdate.


AddMonths(startdate, n , [ , mode])

Return data type: dual

The AddMonths function returns a dual value with both the string and the number value. The function takes the numeric value of the input expression and generates a string representing the number. The string is displayed, whereas the numeric value is used for all numerical calculations and sorting.


Argument Description
startdate The start date as a time stamp, for example '2012-10-12'.
n Number of months as a positive or negative integer.
mode Specifies if the month is added relative to the beginning or to the end of the month. Default mode is 0 for additions relative to the beginning of the month. Set mode to 1 for additions relative to the end of the month. When mode is set to 1 and the input date is the 28th or above, the function checks how many days are left to reach the end of the month on the startdate. The same number of days to reach the end of the month are set on the date returned.

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?