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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement with 2 conditions .

Hello everybody , I need to write an if statement with multiple conditions for example :

if(enter_time+exit_time) >= 2, count(vhcls) .

is there an if formula to do this or should I use another function?

many thanx.

10 Replies
Anonymous
Not applicable
Author

You can use as many condition as you want, but typically the if statement is inside aggregation:

count(if((condition1 or condition2) and (condition3 or condition4) and condition5, vhcls))

Clever_Anjos
Employee
Employee

the syntax is

IF(Cond,TrueExpression,FalseExpression)

where Cond can be

ExpressionA AND|OR ExpressionB AND|OR ExpressionC and so on

Not applicable
Author

Thank you. I mean could I use variables inside an if statement ? If so what's the syntax ?

Many thanx.

Anonymous
Not applicable
Author

You can use variables.
Syntax - it depends what's the content of the variables, and how you're going to use them.  It could be a value, for example your '2' in the opening post can be replaced with a variable.  Or it could be the whole condition, or its part.  If you want a more specific answer, upload your application.

MarcoWedel

maybe you meant

if(enter_time>= 2 AND exit_time >= 2, count(vhcls))


?


regards


Marco

anushahegde
Contributor III
Contributor III

If there are 2 expressions in the fasle expression how to write it?

puneetagarwal
Partner - Creator II
Partner - Creator II

Can you tel some example?

sasiparupudi1
Master III
Master III

Count(if((enter_time+exit_time) >= 2,vhcls)


vMyVariable=(enter_time+exit_time)

Count(if($(vMyVariable)>2,vhcls)

MarcoWedel

Please open a thread for your questions instead of adding them to existing ones.

thanks

regards

Marco