Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Amanda_Tennakoon
Contributor II
Contributor II

Loop through months

Could anyone help me to get a solution for the below scenario? (Date Format is 'MM/DD/YYYY')

1.PNG

 

 

 

 

Cr Date is an account created date, End Date is an account end date, # of Months means the months between created date and end date, Due Date means the day number of each month the payment gets due.

I need to generate this Due Date field as a date like below which is continuos due dates between created date and end date.

1/8/2020

2/8/2020

3/8/2020

4/8/2020

5/8/2020

6/8/2020

Could you please help me out to find a solution for this task?

Labels (1)
1 Solution

Accepted Solutions
rubenmarin

Hi, you can create the additional dates like this:

AddedDueDates:
LOAD [Cr Date],
	AddMonths([Cr Date], IterNo()) as [Due Date]
Resident [DataTable]
While IterNo()<=[# of Months];

View solution in original post

3 Replies
rubenmarin

Hi, you can create the additional dates like this:

AddedDueDates:
LOAD [Cr Date],
	AddMonths([Cr Date], IterNo()) as [Due Date]
Resident [DataTable]
While IterNo()<=[# of Months];
Amanda_Tennakoon
Contributor II
Contributor II
Author

Thank you for the solution RubenMarin but the thing is now it is duplicating rows like this.

2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

This was the code as you suggested.

AddedDueDates:
LOAD
     ACCOUNT_NO,
     AddMonths(Account_Created_Date, IterNo()) as BBBB
Resident NEW_HP
While IterNo() <= PERIOD_MONTHS;

Do you have any suggestion for this duplication?

Amanda_Tennakoon
Contributor II
Contributor II
Author

@rubenmarin Thank you very much for the suggestion. I sorted out all the clarification based on your solution. Thank you again for the support you have given.