Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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

Re: Conditional Expression not working

Just a minor change:

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

9 Replies
Employee
Employee

Re: Conditional Expression not working

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.

Re: Conditional Expression not working

Just a minor change:

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

Employee
Employee

Re: Conditional Expression not working

Thanks Ruben.  I missed that!

-Josh

Not applicable

Re: Conditional Expression not working

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.

Employee
Employee

Re: Conditional Expression not working

Try this:

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

-Josh

Qlik

Not applicable

Re: Conditional Expression not working

This function checks:

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


Not applicable

Re: Conditional Expression not working

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

Re: Conditional Expression not working

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
Honored Contributor III

Re: Conditional Expression not working

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

May you live in interesting times!
Community Browser