Qlik Sense App Development

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.

Thanks

1 Solution

Accepted Solutions
MVP

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

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

MVP

Re: Conditional Expression not working

Just a minor change:

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

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

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.

MVP

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)

Honored Contributor III