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: 
Anonymous
Not applicable

"if" greater or less than in expression

Hey.

I would like to script the following:

if(sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) >=3000 ,Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount), '0'

or

if(Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) <=-3000 ,Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount),'0'))

What I'm trying to achieve is to have my pivot table display the sum(amount) where, sum(amount) is >=3000 or <=  -3000.

at present the above expression only returns the >=3000 part the of expression.

could someone please point me in the right direction

Thanks

Bon

1 Solution

Accepted Solutions
maxgro
MVP
MVP

if(sum(Amount)>=3000 or sum(Amount)<=-3000, sum(Amount),0)

replace sum(Amount) with your expression

View solution in original post

3 Replies
MK_QSL
MVP
MVP

use and instead of or

if(sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) >=3000 and

Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) <=-3000 ,

Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount),0)

Check the number of opening and closing brackets...

maxgro
MVP
MVP

if(sum(Amount)>=3000 or sum(Amount)<=-3000, sum(Amount),0)

replace sum(Amount) with your expression

Anonymous
Not applicable
Author

Thanks Massimo and Manish.

correct expression was OR, using AND returned 0.

if(sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) >=3000 or

Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount) <=-3000 ,

Sum({<Year=,Month=, Date={'>=$(vYTDStart)<=$(vYTDEnd)'}>}Amount),'0')