Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to find the Month between two dates

Hi Geniuses,

I have one issue , below is my data

Customer                              Start Date                              Term                    Amount

    

A30/11/2016 20:00361700000
B15/06/2016 20:001278000
C31/08/2016 20:00120000

I have a start date Term and Amount now what I want is three more columns in which if Start Date is 30/11/2016 and Term is 36 months then the one column will come as end date as 30/11/2019 and then in the other column this 36 months will come as Months(Nov-2016,Dec-2016,Jan-2017 and so on till 36 months) and then in one column the amount will get equally divided between the months and this goes for every client

As you can see the tenure is different and the start date is different  for every client

Thanks in advance,

S

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Something like this:

LOAD

     Customer,

     AddMonths([Start Date], IterNo()-1) as [Start Date],

     AddMonths([Start Date], IterNo()) as [End Date]

     Term,

     Amount,

     Amount / Term as [Monthly Amount]

FROM

     source_data

WHILE

     IterNo() <= Term

     ;


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Something like this:

LOAD

     Customer,

     AddMonths([Start Date], IterNo()-1) as [Start Date],

     AddMonths([Start Date], IterNo()) as [End Date]

     Term,

     Amount,

     Amount / Term as [Monthly Amount]

FROM

     source_data

WHILE

     IterNo() <= Term

     ;


talk is cheap, supply exceeds demand
its_anandrjs

Hi,

If in a script level you want to achieve this you can do this by using date functions (Monthend or date functions) or the for loop for creating the date data for the same.

Regards

Anand

Anonymous
Not applicable
Author

You are awesome sir