Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have the following table:
(where START_DT and END_DT have the format: DD/MM/YYYY)
What I need is to find which months are between my 2 dates (START_DT and END_DT).
For example, in the first row I have: START_DT = 19/11/2012 and END_DT = 17/01/2013
And the result should be:
Months: 11, 12, 01
That would be the months between those 2 dates.
How can I get those values for each row?
Thank you!!!
Generating Missing Data In QlikView
In the Script:
OriginalTable:
Load
*
From DataSource;
//Function to calculate Months Difference in script
SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);
MonthTable:
Load
ACCT_ID
Month( AddMonths(START_DT ,IterNo() - 1)) as Months
Resident OriginalTable
While IterNo() <= ($(MonthDiff(START_DT, END_DT))) ;
Generating Missing Data In QlikView
In the Script:
OriginalTable:
Load
*
From DataSource;
//Function to calculate Months Difference in script
SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);
MonthTable:
Load
ACCT_ID
Month( AddMonths(START_DT ,IterNo() - 1)) as Months
Resident OriginalTable
While IterNo() <= ($(MonthDiff(START_DT, END_DT))) ;