Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

if condition

Hi all,

i have the below code in script

LOAD

     Key_EMS,

     If(Scenario_Type='Consumption', date(Max(Movement_Date),'YYYY-MM')) AS Install_Date,

     If(Scenario_Type='Defective',   date(Max(Movement_Date),'YYYY-MM')) AS Removal_Date

resident Master_Final

group by Key_EMS;


Now i need to pass one more condition in If(Scenario_Type='Defective',   date(Max(Movement_Date),'YYYY-MM')) as Removal_Date,


the condition what i need to pass is the below one


if(Removal_Date>Install_Date,'-',Removal_Date)


Can you please tell me how to achieve  it.


Thanks,

Bharat

1 Reply
michaelsikora
Contributor III
Contributor III

Bharat,

Try doing the following:

Table:

LOAD

     Key_EMS,

     If(Scenario_Type='Consumption', date(Max(Movement_Date),'YYYY-MM')) AS Install_Date,

     If(Scenario_Type='Defective',   date(Max(Movement_Date),'YYYY-MM')) AS Removal_Date

resident Master_Final

group by Key_EMS;


Left Join(Table)

LOAD

     Key_EMS,

     if(Removal_Date>Install_Date,'-',Removal_Date);

resident Table

Group BY Key_EMS;