# How to calculate two aggregations on same field within the same body?

**URL:** https://discuss.elastic.co/t/how-to-calculate-two-aggregations-on-same-field-within-the-same-body/193889
**Category:** Elasticsearch
**Created:** [August 5, 2019, 9:50pm UTC](https://discuss.elastic.co/t/how-to-calculate-two-aggregations-on-same-field-within-the-same-body/193889 "2019-08-05T21:50:58Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Kaushik123](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@Kaushik123](https://discuss.elastic.co/u/Kaushik123)
#### Post date: [August 6, 2019, 5:41pm UTC](https://discuss.elastic.co/t/how-to-calculate-two-aggregations-on-same-field-within-the-same-body/193889/4 "2019-08-06T17:41:26Z")

</div>

Hello @gabriel_tessier,

So far, I have 2 different bodies with 2 different aggregations.

[Queries for aggregations](https://discuss.elastic.co/t/comparing-the-result-sum-count-of-2-aggregations-elasticsearch/193826)

I linked another post shown above. What I am trying to do is compare the results(sum) of the 2 aggregations. In this case, I want to know what the 2xx count is today compared to yesterday. If the count is decreasing, I wish to print a warning or some sort.

How can I accomplish this using elasticsearch (elasticsearch dsl)?

---

_[View the full topic](https://discuss.elastic.co/t/how-to-calculate-two-aggregations-on-same-field-within-the-same-body/193889)._
