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

How to make Multiple 'if' function

I need to make an expression with multiple 'if' functions:

If('order_status' = 'A' and 'Confirm_date'-'Create_date'>1, 'Quantity',0) as Late_quantity,

however, another kind of orders should be also categorised as late orders:

If('order_status' = 'B' and 'Confirm_date' is null and Today()-'Create_date'>1,'Quantity',0) as Late_quantity.

Is it possible to make an expression in Qlikview to cover both cases into one scenario?

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi Peter,

try this

=If('order_status' = 'A' and 'Confirm_date'-'Create_date'>1, 'Quantity',

If('order_status' = 'B' and 'Confirm_date' is null and Today()-'Create_date'>1,'Quantity',0)) as Late_quantity

Regards,

Jagan.

View solution in original post

6 Replies
rajni_batra
Specialist
Specialist

Try This

If('order_status' = 'A' and 'Confirm_date'-'Create_date'>1, 'Quantity',

   If('order_status' = 'B' and 'Confirm_date' is null and Today()-'Create_date'>1,'Quantity') as Late_quantity.

jagan
Partner - Champion III
Partner - Champion III

Hi Peter,

try this

=If('order_status' = 'A' and 'Confirm_date'-'Create_date'>1, 'Quantity',

If('order_status' = 'B' and 'Confirm_date' is null and Today()-'Create_date'>1,'Quantity',0)) as Late_quantity

Regards,

Jagan.

Not applicable
Author

Thank Jagan!

It works! But just another question: if I want to do something like: if 'Confirm_date' is not null, then..., how to code the "is not null" function?

Peter

Not applicable
Author

Thank Jagan!

It works! But just another question: if I want to do something like: if 'Confirm_date' is not null, then..., how to code the "is not null" function?

Peter

rajni_batra
Specialist
Specialist

use

not isnull(date)

Not applicable
Author

Thanks Rajni!!

Peter