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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Berg_127
Contributor II
Contributor II

Underwriting Years

Hi Community,

Really need your help with a coding challenge I'm facing. I'm a coding novice, but need assistance coding the following in the loadscript:

I need to calculate a sequential underwriting year and the start and end dates of an underwriting year by extrapolating from the original policy inception date. 

As an example, if a client incepted coverage on 01 August 2020 (ie original policy inception date), the underwriting years would be calculated as follows:

1 > 01 Aug 2020 to 31 Jul 2021

2 > 01 Aug 2021 to 31 Jul 2022

3 > 01 Aug 2022 to 31 Jul 2023

And so forth. 

Currently, I only avail of the original inception date and the assumption that all policy periods are 12 months. 

Help! Please 🙂 

Labels (1)
2 Solutions

Accepted Solutions
Daniel_Castella
Support
Support

Hi @Berg_127 

 

Could you try this script? I have put some random dates in the inline. Hence, adjust it for the values you need.

 

A:
LOAD Customer, Subscription
INLINE [
Customer, Subscription
A, 23/09/2020
B, 23/02/2020
C, 30/03/2021
D, 31/03/2021
E, 01/04/2022
F, 02/04/2022
G, 03/04/2023
H, 06/06/2023
I, 07/06/2024
J, 08/06/2025
K, 09/06/2025
L, 10/06/2025
];
 
A1:
LOAD Min(Year(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'))) as Min_Year
Resident A;
 
LET vYearsMin = peek('Min_Year',0,'A1');
LET vYears = Year(Today()) - $(vYearsMin);
 
For i=0 to $(vYears)
B:
LOAD Customer, 
AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*($(i))) as Subscription_Start_Period,
AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*($(i)+1)) as Subscription_End_Period,
$(i)+1 as Underwriting
RESIDENT A
Where AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*$(i))<=Date(Today(),'DD/MM/YYYY');
 
NEXT i;
 
DROP TABLE A, A1;

 

Let me know if it works for you.

 

Kind Regards

Daniel

View solution in original post

Berg_127
Contributor II
Contributor II
Author

Thank you so much, Daniel.

I sincerely appreciate the prompt response and assistance.

I am going to test this and let you know if I need any assistance.

 

Thank you again!! 

View solution in original post

3 Replies
Daniel_Castella
Support
Support

Hi @Berg_127 

 

Could you try this script? I have put some random dates in the inline. Hence, adjust it for the values you need.

 

A:
LOAD Customer, Subscription
INLINE [
Customer, Subscription
A, 23/09/2020
B, 23/02/2020
C, 30/03/2021
D, 31/03/2021
E, 01/04/2022
F, 02/04/2022
G, 03/04/2023
H, 06/06/2023
I, 07/06/2024
J, 08/06/2025
K, 09/06/2025
L, 10/06/2025
];
 
A1:
LOAD Min(Year(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'))) as Min_Year
Resident A;
 
LET vYearsMin = peek('Min_Year',0,'A1');
LET vYears = Year(Today()) - $(vYearsMin);
 
For i=0 to $(vYears)
B:
LOAD Customer, 
AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*($(i))) as Subscription_Start_Period,
AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*($(i)+1)) as Subscription_End_Period,
$(i)+1 as Underwriting
RESIDENT A
Where AddMonths(Date(Date#(Subscription,'DD/MM/YYYY'),'DD/MM/YYYY'),12*$(i))<=Date(Today(),'DD/MM/YYYY');
 
NEXT i;
 
DROP TABLE A, A1;

 

Let me know if it works for you.

 

Kind Regards

Daniel

Berg_127
Contributor II
Contributor II
Author

Thank you so much, Daniel.

I sincerely appreciate the prompt response and assistance.

I am going to test this and let you know if I need any assistance.

 

Thank you again!! 

Berg_127
Contributor II
Contributor II
Author

Thank you, Daniel.

 

Really appreciate your assistance!

 

This worked perfectly!