Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding months to Date

Hi,

Is it possible within QlikView to add months to a date?

For example have this script:

set startDate = '01/01/2012'

set enddate = '01/04/2012'

let a=Interval(month(endDate)-month(startDate),'m');

for i = 0 to a;

let filename = Date(Date(startDate+i),'MM')&' '&Date(Date(startDate+i),'MMMM')&' '&YEAR(Date(startDate+i))&' - Data.xls';

the "startDate+i" is adding days.  How do I add this to the month instead?

Any help would be greatly appreciated.

Labels (1)
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use AddMonths(startdate, n) where startdate is the date you wish to add to, n is the number of months (negative for prior months)

     AddMonths('2012/05/25', 3)  ->  2012/08/25

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, look at the function AddMonths().

Ask me about Qlik Sense Expert Class!
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use AddMonths(startdate, n) where startdate is the date you wish to add to, n is the number of months (negative for prior months)

     AddMonths('2012/05/25', 3)  ->  2012/08/25

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein