# Sum aggregation

**URL:** <https://discuss.elastic.co/t/sum-aggregation/121667>\
**Category:** Elasticsearch\
**Created:** [February 27, 2018, 1:59pm UTC](https://discuss.elastic.co/t/sum-aggregation/121667 "2018-02-27T13:59:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robbe482](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@robbe482](https://discuss.elastic.co/u/robbe482)\
**Post date:** [February 27, 2018, 1:59pm UTC](https://discuss.elastic.co/t/sum-aggregation/121667/1 "2018-02-27T13:59:09Z")

</div>

Hi, I cant figure out how to make the following aggregation. (This is on 1.7)  
I have objects that look like following:

{"currencyRate": 2, "orderRow": [{"value": 1000, "productId": 1},{"value": 1000, "productId": 1}, {"value": 1000, "productId": 2}]}

What i want to do is: For every object sum the value of all orderRows with productId = 1 then multiply that value with the currencyRate. Then sum all of those values for all objects.

Any ideas how to do this?

Thanks, Robin.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 27, 2018, 1:59pm UTC](https://discuss.elastic.co/t/sum-aggregation/121667/2 "2018-03-27T13:59:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
