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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
shahafei2
Creator
Creator

Set analysis sum with aggr or aggr sum with condition

Hi all,

I would like to calculate order's volume per warehouse in straight table 

The dimensions are Date, Time and Order D

In the DB each order contains multiple lines (Products) with different volume and quantity  

the calculation that i'm trying to use for WH A :

Sum({<WH={'A'}>}(Quantity*Volume))

but for some reason im getting wrong result

 

I suspect that the reason is the different volume/quantity in each line

there is a way to calculate it with inner aggr ? 

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

>>but for some reason im getting wrong result

That's not a lot of information to diagnose your problem. There is nothing obviously wrong with your expression, but whether it is right or wrong it depends on your data model.

>>there is a way to calculate it with inner aggr ? 

Perhaps, but don't use an aggr if its not required.

Are there a lot of null values in either field? This could be a problem. If either field has a null value, the result is 0 even if the other field is not null.

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

Your expression might need an aggr like:

sum(aggr(Sum({<WH={'A'}>}(Quantity*Volume)), OrderID, ProductID))

but I think it would be better to calculate Quantity*Volume already within the script.

- Marcus

shahafei2
Creator
Creator
Author

Thank you, i will try to calculate it in the script instead