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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Change in logic using dates

If(len(trim([K04 Date]))<>0,

if (not(Match( [Inv Grp],'FHA')),

  (if(day([K04 Date])<=15,date(monthstart(addmonths([K04 Date],1))),date(monthstart(addmonths([K04 Date],2))))),

If(len(trim([K04 Date]))<>0,

if (Match( [Inv Grp],'FHA'),

  (if(day([K04 Date])<=20,date(monthstart(addmonths([K04 Date],1))),date(monthstart(addmonths([K04 Date],3))))),

               if([LM Workout Status Act]='IN TRIAL',[K04 Date],

This means that if a K04 date exists then if the investor group is not FHA and the date occurred within the first 15 days, advance 1 month, else advance 2 months.  Do the same if the investor group is FHA except advance 1 and 3 months respectively.

Here is my issue:  Now the FHA portion has been replaced by a completed 490,491 or 492.  Does this mean the I now have to insert the if([LM Workout Status Act]='IN TRIAL',[K04 Date], after the first loop in the code only and could I define a date that encompasses all

3 dates mentioned and then use it in the second part of the code only???

load

if(len(trim([490]) <>0 or (len(trim([491]) <>0 or (len(trim([491])<>0,  ????? as fha_date or something similar ???

in other words create this and load it prior to the code mentioned

2 Replies
sunny_talwar

Can you share a few lines of old data and few lines of new data to understand what has changed and provide you a solution

Not applicable
Author

 

/*Current Data*/

 

load       
If(len(trim([K04 Date]))<>0,
if (not(Match( [Inv Grp],'FHA')),
(
if(day([K04 Date])<=15,date(monthstart(addmonths([K04 Date],1))),date(monthstart(addmonths([K04 Date],2))))),
/*if([LM Workout Status Act]='IN TRIAL',[K04 Date],*/
If(len(trim([K04 Date]))<>0,
if (Match( [Inv Grp],'FHA'), /*this must be altered*/
(
if(day([K04 Date])<=20,date(monthstart(addmonths([K04 Date],1))),date(monthstart(addmonths([K04 Date],3))))),
if([LM Workout Status Act]='IN TRIAL',[K04 Date],            

If(len(trim([367]))<>0,
if (not(Match( [Inv Grp],'FHA')),
(
if(day([367])<=15,date(monthstart(addmonths([367],1))),date(monthstart(addmonths([367],2))))),
/*if([LM Workout Status Act]='IN TRIAL',[367]   ,*/              
If(len(trim([367]))<>0,
if (Match( [Inv Grp],'FHA'), /*this must be altered*/
(
if(day([367])<=20,date(monthstart(addmonths([367],1))),date(monthstart(addmonths([367],3))))),
if([LM Workout Status Act]='IN TRIAL',[367]          


))))))))))
as [trial1_due_dt] ,

 

 

Now I need to alter the section marked, this must be altered. Essentially the K04 Date is replaced by a 490,491 or 492.  Only one date will occur.

 

My questions are

 

  1. Would I now need to insert the if([LM Workout Status Act]='IN TRIAL',[K04 Date],   after the first 3 lines of code, currently commented out

  Could I create a date function to handle the 490,491 and 492 and then pass it to the FHA portion of the code only