Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to sum the an expression with aggregates

Hi everyone.

So the following expression of mine shows a 1 if the value is bigger than 0, and a 0 if not.

=if((sum(aggr(sum([Stk Adj Qty]),[SK Branch No])) + sum(aggr(sum([Inflow Qty]),[SK Branch No]))) > 0 , 1 ,0)

basically what it does it to check if the sum of Stk Adj Qty and Inflow Qty is bigger than 0 with branch as dimension

What I'd like to do is to sum all those 1's together to give me a total on the caption of the object, but it just wont work.

Any idea on what I'm doing wrong?

Thank you guys

5 Replies
awhitfield
Partner - Champion
Partner - Champion

Hi Stefan,

can you post your app please?

Andy

Not applicable
Author

Hi,


Try to check result of following exp in yur app,


=sum(aggr(sum([Stk Adj Qty]),[SK Branch No])) also,

=sum(aggr(sum([Inflow Qty]),[SK Branch No])))

& see whether it is working properly or not else your exp looks correct...

jonathandienst
Partner - Champion III
Partner - Champion III

=Sum(Aggr(if((sum(aggr(sum([Stk Adj Qty]),[SK Branch No])) + sum(aggr(sum([Inflow Qty]),[SK Branch No]))) > 0 , 1 ,0), <table dimensions>))

where <table dimensions> is a comma separated list of the table dimensions

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sunny_talwar

or another alternative would be, if it is a straight table that you are using, is to use the QlikView inbuilt total mode. You can select Sum and it should sum the expression you had initially

=if((sum(aggr(sum([Stk Adj Qty]),[SK Branch No])) + sum(aggr(sum([Inflow Qty]),[SK Branch No]))) > 0 , 1 ,0)


Total Mode.PNG


I hope this helps.


Best,

Sunny

shambhub
Creator
Creator

Stefan,

Try like this

=sum(if((sum(aggr(sum([Stk Adj Qty]),[SK Branch No])) + sum(aggr(sum([Inflow Qty]),[SK Branch No]))) > 0 , 1 ,0))

Best Regards

Shambhu B