Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

vireshkolagimat
Contributor III

Qty getting doubled while calculating sum

Dear All,

I'm calculating sum of qty sold as one exp and sum of qty sold multiplied by packsize in another exp.

But the first exp works fine but second one is not showing the correct values.

I tried to use the distinct in the second exp but still facing issues.

Regards,

Viresh

 Packsize issue.PNG

2 Solutions

Accepted Solutions

Re: Qty getting doubled while calculating sum

Hi, as Packsize is a dimension and will have only one value you can try with "Packsize*Sum(SalesQty)" or "Packsize*Column(1)"

Re: Qty getting doubled while calculating sum

Hi, total fails because of having difrferent values for Packsize, you can set the expression as:
Sum(Aggr(Sum(SalesQty)*Packsize, ProductCode, ItemCode, Packsize))

Or just:
Sum(Aggr(Sum(SalesQty)*Packsize, Packsize)) //does the operation for each Packsize and sums all generated values
6 Replies
shiveshsingh
Honored Contributor

Re: Qty getting doubled while calculating sum

If you remove item code dimension, then what is the result?

Re: Qty getting doubled while calculating sum

Hi, as Packsize is a dimension and will have only one value you can try with "Packsize*Sum(SalesQty)" or "Packsize*Column(1)"
vireshkolagimat
Contributor III

Re: Qty getting doubled while calculating sum

Hi, i think it works fine but can't show the total even though I've enabled show partial sum option in the presentation tab.

Packsize issue2.PNG

Thank you.

vireshkolagimat
Contributor III

Re: Qty getting doubled while calculating sum

Hi, i tried but no changes. Thank you.

Re: Qty getting doubled while calculating sum

Hi, total fails because of having difrferent values for Packsize, you can set the expression as:
Sum(Aggr(Sum(SalesQty)*Packsize, ProductCode, ItemCode, Packsize))

Or just:
Sum(Aggr(Sum(SalesQty)*Packsize, Packsize)) //does the operation for each Packsize and sums all generated values
vireshkolagimat
Contributor III

Re: Qty getting doubled while calculating sum

Hi, I was able to fix it and used the same logic. Thank you.