Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

ADD MONTHS

Hi Friends

 

PERIOD_FROMPERIOD_TO
22-03-1721-01-18
07-04-1706-04-18
07-04-1706-04-18
03-08-1702-08-18
08-08-1707-08-18
31-08-1730-08-18
15-09-1714-09-18
31-08-1730-08-18
19-09-1718-09-18

I have above date range. I want to add all month end dates between two dates. Pls help me

Eg 22-03-17    21-01-18

add  months  31-03-17,30-04-17, 31-05-17 ................31-01-18

6 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

hello,

I have used interval match with a calender merged with your intervals data in order to get all mon starts from the calender:

cout of month starts of each of your intervals:

Capture.PNG

when selecting one date range:

Capture2.PNG

please check script in qvw!

Best Regards,

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

QlikView Qlik Sense consultant
upaliwije
Creator II
Creator II
Author

Thanks Dear

I will chcek abd come back to you,. If ypu can help me my previous thread "

Distribution of Days among months'

I will be much greatful to you

kfoudhaily
Partner - Creator III
Partner - Creator III

I see, not simple problem but I think you will have to use same method in qvw above (intervalmatch fonction)

not very available during the day, I will have a look at your problem tonight.

regards,

QlikView Qlik Sense consultant
upaliwije
Creator II
Creator II
Author

Ok Thanks Dear

Anil_Babu_Samineni

This also works as your start date is Mar-2017 and Max date is Sep-2018. Below script generate all month end till date from source.

Period_Table:

LOAD * Inline [

PERIOD_FROM, PERIOD_TO

22-03-17, 21-01-18

07-04-17, 06-04-18

07-04-17, 06-04-18

03-08-17, 02-08-18

08-08-17, 07-08-18

31-08-17, 30-08-18

15-09-17, 14-09-18

31-08-17, 30-08-18

19-09-17, 18-09-18

];

CalendarMaster:

LOAD Date(DateField) AS PERIOD_FROM, MonthEnd(DateField) as MonthEnd;

LOAD Date(MinDate + IterNo() - 1) as DateField While (MinDate + IterNo() - 1) <= Num(MaxDate);

LOAD Min(PERIOD_FROM)as MinDate,

Max(PERIOD_TO) as MaxDate

Resident Period_Table;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
upaliwije
Creator II
Creator II
Author

Thanks Anil

Your method meets my requirement . But I want to add something to it . I have some other fields in my data table. Eg Policy No . When I apply your script to my table I get only one month end date for each policy whereas I want all Month end dates between Period_from to Period_to against each policy.

Example shown below. I have also attached my sample data. Kindly help me please

    

POLICY_NOTRN_DATEPERIOD_FROMPERIOD_TOINTERVALMonthEnd
1007/7/20173/22/20171/21/20183063/31/2017
1007/7/20173/22/20171/21/20183064/30/2017
1007/7/20173/22/20171/21/20183065/31/2017
1007/7/20173/22/20171/21/20183066/30/2017
1007/7/20173/22/20171/21/20183067/31/2017
1007/7/20173/22/20171/21/20183068/31/2017
1007/7/20173/22/20171/21/20183069/30/2017
1007/7/20173/22/20171/21/201830610/31/2017
1007/7/20173/22/20171/21/201830611/30/2017
1007/7/20173/22/20171/21/201830612/31/2017
1007/7/20173/22/20171/21/20183061/31/2018