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: 
capriconuser
Creator
Creator

conditions according to the year

this is the data

M NOM_PolicyYear 
    
1231112018change
abc 2019new
223122-12020change

 

in this data i want if M_policy not have any policy and year is current year then consider this M NO as "new " so .. if next year come if there is no update on policy abc .. like this abc NO is again assigned and M_Policy have old MNO which is in 2019 so the data would be like this 

M NOM_PolicyYear 
    
1231112018change
abc 2019new
abc-1abc2020renewal
223122-12020change

 

but if no policy is assigned again in next year then this considered to be as "LOSS" (assume current year is 2020)

 

M NOM_PolicyYear 
    
1231112018change
abc 2019lost
223122-12020change

so i want to search M No in data like if abc did not assign in upcoming year then this should be considered as LOSS.. 

 

any help

1 Solution

Accepted Solutions
Zhandos_Shotan
Partner - Creator II
Partner - Creator II

According to example that your send in priv message:

if there is no new number generate in old policy no against polices  then consider as "lost business" other wise above record is renewal business .. so this should be like this 

P No.Old_PolicyYear 
    
1221112018renweal
122-11222019renweal
122-2122-12020renweal
122-3122-22021renweal
122-4122-32022renweal
P/03/Me/2018/00002-2018lost
P/03/Me/2018/00003-2018new 
P/03/Me/2018/00003-1000032019renweal
P/03/Me/2018/00003-200003-12019renweal
P/03/WC/2019/00001-2019new 
P/03/WC/2019/00004-2019new 
P/05/WC/2019/0004800432016renweal
P/11/WC/2019/00011-2019new 
P/11/WC/2019/00013-2019new 

 

I created additional PGroup field in script with subfiled function 

SubField([P No.],'-',1) as PGroup

and expression:

if(Len(Old_Policy)>0,
'renew',
if(Year<Year(Today()) and Count(Total<PGroup> [P No.])=1,
'lost',
'new'))

 

Check the attachment. Is it what you want?

 

 

View solution in original post

2 Replies
Zhandos_Shotan
Partner - Creator II
Partner - Creator II

According to example that your send in priv message:

if there is no new number generate in old policy no against polices  then consider as "lost business" other wise above record is renewal business .. so this should be like this 

P No.Old_PolicyYear 
    
1221112018renweal
122-11222019renweal
122-2122-12020renweal
122-3122-22021renweal
122-4122-32022renweal
P/03/Me/2018/00002-2018lost
P/03/Me/2018/00003-2018new 
P/03/Me/2018/00003-1000032019renweal
P/03/Me/2018/00003-200003-12019renweal
P/03/WC/2019/00001-2019new 
P/03/WC/2019/00004-2019new 
P/05/WC/2019/0004800432016renweal
P/11/WC/2019/00011-2019new 
P/11/WC/2019/00013-2019new 

 

I created additional PGroup field in script with subfiled function 

SubField([P No.],'-',1) as PGroup

and expression:

if(Len(Old_Policy)>0,
'renew',
if(Year<Year(Today()) and Count(Total<PGroup> [P No.])=1,
'lost',
'new'))

 

Check the attachment. Is it what you want?

 

 

Brett_Bleess
Former Employee
Former Employee

Did Zhandos' post get you what you needed?  If so, please consider using the Accept as Solution button to give them credit for the effort and to let other know this was the solution.  If you did something else, please consider posting that and  you can then mark that as the solution...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.