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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ena1309
Contributor III
Contributor III

IF OR AND statements

Hi guys, 
i am having trouble to create this Tableau expression in Qlik 

IF SUM([Field1])=0 OR SUM([Field2])=0 THEN SUM([Adjustment Quantity])/1 ELSE SUM([Field1])/SUM([Field2]) END

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

In that case, you'll need to work around the lack of AND/OR by nesting if() statements, or combine the conditions, e.g.

If(Sum(Field1)*Sum(Field2) <> 0,Something, SomethingElse)

might achieve the same purpose as checking each field for zero individually.

View solution in original post

5 Replies
Or
MVP
MVP

Seems like a straightforward If() statement? See: https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/Conditi...

IF(SUM([Field1])=0 OR SUM([Field2])=0 ,SUM([Adjustment Quantity]) ,SUM([Field1])/SUM([Field2]))

 

ena1309
Contributor III
Contributor III
Author

yeah, but i have issue with combining that with OR and AND  statements 

Or
MVP
MVP

Generally, if(Condition1 OR Condition2,When_True,When_False) is the syntax. This should work in both the Load Script Editor and in Qlik formulas (but not the Data Manager, for reasons known only to the fine folks at Qlik)

ena1309
Contributor III
Contributor III
Author

Ohh Thank you a lot ! 
I was trying to do this in Data Manager, so this pretty much explains the problem  

Or
MVP
MVP

In that case, you'll need to work around the lack of AND/OR by nesting if() statements, or combine the conditions, e.g.

If(Sum(Field1)*Sum(Field2) <> 0,Something, SomethingElse)

might achieve the same purpose as checking each field for zero individually.