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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Expression not working

Hi,

I need to implement the following logic inside a measure:

If (DATE_ID >=1465 or DATE_ID <=1556) then Sum( Field1- (Field 2+Field 4)/ Sum(Field 3)

I tried using an expression : Sum({<DATE_ID ={">=1465"}>}  {<DATE_ID ={"<=1556"}>} (Sum( Field1- (field 2+Field 4)/ Sum(Field 3)))

The expression doesn't work.probably because it has multiple operators.

Please suggest a solution.

Thanks

1 Solution

Accepted Solutions
rubenmarin

Just a minor change:

Sum({<DATE_ID ={">=1465<=1556"}>} Field1- (field 2+Field 4)/ Sum(Field 3))

View solution in original post

9 Replies
Josh_Good
Employee
Employee

Hi Soumya,

I think you just have a minor syntax issue. Try this:

Sum({<DATE_ID ={">=1465"}>}, DATE_ID ={"<=1556"}>} Field1- (field 2+Field 4)/ Sum(Field 3))


-Josh

Qlik


Please mark my response as helpful or correct so other member can find answers more quickly.

rubenmarin

Just a minor change:

Sum({<DATE_ID ={">=1465<=1556"}>} Field1- (field 2+Field 4)/ Sum(Field 3))

Josh_Good
Employee
Employee

Thanks Ruben.  I missed that!

-Josh

Not applicable
Author

I tried using this expression:  Sum({<DATE_ID ={">=1465<=1556"}>} Field1- (field 2+Field 4)/ Sum(Field 3))

When I use the Sum function inside expression 'Sum(Field3)'. It says expression is wrong. And If I leave the 'Sum' function out, there's no error but the division part is not working in the calculation.

Josh_Good
Employee
Employee

Try this:

Sum({<DATE_ID ={">=1465<=1556"}>} Field1- (field 2+Field 4)/ Field 3)

-Josh

Qlik

Not applicable
Author

This function checks:

if(DATE_ID >=1465,if(DATE_ID <=1556,sum( Field1- (Field 2+Field 4)/ Sum(Field 3)))


Not applicable
Author

Thank you all. I used the expression to create a variable. It's working.

rubenmarin

Maybe one of these:

Sum({<DATE_ID ={">=1465<=1556"}>} Field1- (field 2+Field 4))/ Sum({<DATE_ID ={">=1465<=1556"}>} Field 3))


Sum({<DATE_ID ={">=1465<=1556"}>} (Field1- (field 2+Field 4))/ Field 3)

oknotsen
Master III
Master III

If your question is answered, please flag correct and helpful answer(s).

May you live in interesting times!