Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
capriconuser
Creator
Creator

Status change according to if condition

I am trying this condtion but this shows an error

  

 

 

if(UW_YEAR<Year(Today()) and Len(OLD_POLICY_NUMBER)>0 , 'renew','lost', if(UW_YEAR<Year(Today()) and Count(Total POLICY_NO)=1, 'lost', 'new'))

 

 

first condition 

P No.Old_PolicyYear 
1221322013renew
1341222014renew
    

now if this 122 old policy did not find in 2019 means in current year then this should be lost 

so data will be 

P No.Old_PolicyYear 
1221322013renew
1341222014lost

and if this continues then status would be renew ie. .

P No.Old_PolicyYear 
1221322013renew
1341222014renew
1441342019renew

 

second contion 

P No.Old_PolicyYear 
111 2013lost
131 2014lost
144 2019new

 

if there is no old policy number then this should be lost and if policy no exist in 2019 (always current year) then policies should be new .. if there is 2020 (current year next year) then always new .. 

 

 basically trying to combine 2 conditions  any help

 

 

3 Replies
lockematthewp
Creator II
Creator II

I think this is what you are looking for. Your if condition can only have two options (if and else). Your first one has three which is why it does not work. (renew, lost, other if)

if(Len(OLD_POLICY_NUMBER)=0 , 'lost',
if(UW_YEAR<Year(Today()) and Len(OLD_POLICY_NUMBER)>0 , 'renew', 'new')

capriconuser
Creator
Creator
Author

what about this.. 

Count(Total POLICY_NO)=1
capriconuser
Creator
Creator
Author

hello ?