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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SUM expression question

Hi,

I was looking at an app that someone developed.  One of the charts has this expression:

= sum({<_RevenueFlag-={1}>} TransactionAmountInDollars)

I believe it means sum the TransactionAmountInDollars where _RevenueFlag = 1.  However I noticed there is what

appears to be a minus or hyphen symbol between _RevenueFlag and the equal sign.  Can someone explain what that

means or what this expression maybe doing?

Thanks

9 Replies
sunny_talwar

It means sum TransactionAmountInDollars where _RevenueFlag is not equal to 1

Anonymous
Not applicable
Author

Sunny, thanks for the quick response.  Personally I would coded it as _RevenueFlag  = (0) since it can only be

0 or 1.  This is much clearer.

sunny_talwar

I agree. Its much more easier to understand

maxgro
MVP
MVP

All  _RevenueFlag   of the selection   except  -1

Anonymous
Not applicable
Author

maxgro,

Can you please explain what "except -1" mean?  I have only been working with QV for a few weeks.

Thanks

Anonymous
Not applicable
Author

-1 is excluded, so you will see everything else.

maxgro
MVP
MVP

<F1=-{a}>     is b, c

<F1-={a}>     is selected -a, --> b

1.png

you can find in

Set Analysis: syntaxes, examples

effinty2112
Master
Master

Hi Sidney,

We need to be a bit careful here, the expression

= sum({<_RevenueFlag-={1}>} TransactionAmountInDollars)


will not include in the calculation records that have RevenueFlag = 1 or that have null RevenueFlag. In your case as the flag is always non-null this is not a consideration but it should be bourne in mind.


If I can use your example as an illustration, if some of your records had null RevenueFlag and you wanted to sum up all that were not set to 1 in this field then the expression


= sum({$-<_RevenueFlag={1}>} TransactionAmountInDollars)


would include the records in the default selection state with null RevenueFlag and also non-nulls <> 1.

Anonymous
Not applicable
Author

Thanks Andrew and others who responded.  I will need to go through these samples myself to see how the results come out when I play around with this expression.