Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Thabang231
Contributor III
Contributor III

If statement return incorrect Strings

Hi There

Please assist on the following: I currently want my analysis to return the string where if the field <= 1.5 should return "Trips Depart <=90min" else should return "Trips Depart greater than 90min", 

check I have wrote the logic on data loader :

If((Interval("[Var Actual vs Planned]") <= 1.5) , 'Trips Depart <=90min of Planned Trip Start Time',
'Trips Depart Greater than 90min of Planned Trip Start Time') as [% of trips departing within 90 minutes ],

But the above logic is not returning the correct values on the analyze sheet. The only time it returns the second statement (Trips Depart Greater than 90min of Planned Trip Start Time) it is when there is null or (-)value.

please see the attachments and assist . 

Thanks in advance!

Labels (1)
3 Replies
brunobertels
Master
Master

hi 

perhaps try this 

If((Interval("[Var Actual vs Planned]") <= '1.5') , 'Trips Depart <=90min of Planned Trip Start Time',
'Trips Depart Greater than 90min of Planned Trip Start Time') as [% of trips departing within 90 minutes ],

BrunPierre
Partner - Master
Partner - Master

Like this?

If((Interval("[Var Actual vs Planned]",'mm') <= 90) , 'Trips Depart <=90min of Planned Trip Start Time',
'Trips Depart Greater than 90min of Planned Trip Start Time') as [% of trips departing within 90 minutes ]

or

If((Interval("[Var Actual vs Planned]",'mm') <=Interval('01:30','hh:mm')*24*60) , 'Trips Depart <=90min of Planned Trip Start Time',
'Trips Depart Greater than 90min of Planned Trip Start Time') as [% of trips departing within 90 minutes ]

Thabang231
Contributor III
Contributor III
Author

@BrunPierre  & @brunobertels thanks so much , i have tried to check the above solution and here is the one that best corrected my logic 

if(Interval([Var Actual vs Planned])>0,
if((Interval([Var Actual vs Planned])*24)>1.5,
'Trips Depart Greater than 90min of Planned Trip Start Time','Trips Depart <=90min of Planned Trip Start Time'),
'Trips Depart <=90min of Planned Trip Start Time') as [% of trips departing within 90 minutes of the planned trip start ]

 

Thanks once again!