Skip to main content

# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
An issue has been identified on Qlik Cloud hub, please visit our Status Update Page for details: GET THE LATEST
cancel
Showing results for
Search instead for
Did you mean:
Contributor III

## show sum OR which is less than 0

Hi, I want to calculate the sum value whose  the difference value is less than 0 in two year.  Here comes my function, but it shows -, if I changed into >0, it will show the value, what's wrong with it?

if(sum(aggr(\$(V_CY Till_OR)-\$(V_PY_Till_OR),CNOC))<0,sum(aggr((\$(V_CY Till_OR)-\$(V_PY_Till_OR)),CNOC)))

1 Solution

Accepted Solutions
Champion III

Try below

=sum( aggr(

if(  \$(V_PY_Till_OR)> \$(V_CY Till_OR),\$(V_CY Till_OR)-\$(V_PY_Till_OR) )

,CNOC))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
6 Replies
Champion III

can you post a screenshot from the expression editor?

also what are variables  V_CY Till_OR  and  V_PY_Till_OR

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Contributor III
Author

Pls take a look. Thank you so much

Contributor III
Author

if I changed into >0, It will work. like below

Contributor III
Author

If I select a customer whose difference value is  less than 0, this function will show the value, if I don't select , it will show -

if(sum(aggr(\$(V_CY Till_OR)-\$(V_PY_Till_OR),CNOC))<0,sum(aggr((\$(V_CY Till_OR)-\$(V_PY_Till_OR)),CNOC)))

Champion III

Try below

=sum( aggr(

if(  \$(V_PY_Till_OR)> \$(V_CY Till_OR),\$(V_CY Till_OR)-\$(V_PY_Till_OR) )

,CNOC))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Contributor III
Author

wow, It works. But  What's the reason?

Tags
Community Browser