Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Certification Exam Sale - 40% off. Register by June 30, 2020. GET DETAILS
Highlighted
Contributor

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
Highlighted
MVP
MVP

Re: Set analysis sum with aggr or aggr sum with condition

>>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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Set analysis sum with aggr or aggr sum with condition

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

Highlighted
Contributor

Re: Set analysis sum with aggr or aggr sum with condition

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