Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

stephenhasson
Contributor

Summation error

Hello,

I have a calculated field in a grid that works fine, taking a value X and multiplying it by the value Y to give Z.

X is pulled from a part's record representing an amount of explosive per KG, Y is the qty (in KG) of a part in stock. Z = the total explosive amount for the part.

On a grid showing all the parts, quantities, the warehouse codes etc. the calculation works fine:

=round(NEQPerItemKG*sum(OnhandQty), .00001)

But if I have a similiar grid, but take out the part/qty etc, in order to see totals by warehouse, the calculation doesn't work.

Screen shots attached. Any help appreciated.

Thanks.

1 Solution

Accepted Solutions
stephenhasson
Contributor

Re: Summation error

Thanks both for your replies.

I'd just added a copy of the app when the second reply came in - and this works perfectly.

I really need to get my head round the set analysis...... I think this says 'do this calculation on the whole dataset, irrespective of any selections that have been made on these 5 fields', am I right?

Thank you.

Stephen

7 Replies
vkish16161
Contributor III

Re: Summation error

More explanation needed where the calculation is failing.

What formula are you using and what's the expected output?

Re: Summation error

Try this

Sum(Aggr(Round(NEQPerItemKG*sum(OnhandQty), .00001), Code, Warehouse, PartNum, Description, LotNum))

stephenhasson
Contributor

Re: Summation error

Thanks both for your replies.

I'd just added a copy of the app when the second reply came in - and this works perfectly.

I really need to get my head round the set analysis...... I think this says 'do this calculation on the whole dataset, irrespective of any selections that have been made on these 5 fields', am I right?

Thank you.

Stephen

Re: Summation error

The syntax that I provided isn't called set analysis.... it is just a way to get total from a more granular level dimensions... So within the Aggr() function, it will created a imaginary table and perform all the calculations at that level and then sum them up just like the table you have below in the snapshot. All selections will be honored, so no need to worry on that front

stephenhasson
Contributor

Re: Summation error

Great, thanks for your help. I appeciate it.

Regards,

Stephen

Extension : 7060

Telephone : +44 1294 487060

Re: Summation error

Yup, no problem

Please close this thread if everything is working for you...

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

stephenhasson
Contributor

Re: Summation error

Great, thanks for your help. I appeciate it.

Regards,

Stephen

Extension : 7060

Telephone : +44 1294 487060

Community Browser