# Kibana sum aggregation not showing the correct values when I use divide in Json Input

**URL:** <https://discuss.elastic.co/t/kibana-sum-aggregation-not-showing-the-correct-values-when-i-use-divide-in-json-input/282473>\
**Category:** Kibana\
**Tags:** painless, kql-kibana-query-language\
**Created:** [August 25, 2021, 10:15am UTC](https://discuss.elastic.co/t/kibana-sum-aggregation-not-showing-the-correct-values-when-i-use-divide-in-json-input/282473 "2021-08-25T10:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![im.manoj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/im.manoj/32/69839_2.png) [@im.manoj](https://discuss.elastic.co/u/im.manoj)\
**Post date:** [August 25, 2021, 10:15am UTC](https://discuss.elastic.co/t/kibana-sum-aggregation-not-showing-the-correct-values-when-i-use-divide-in-json-input/282473/1 "2021-08-25T10:15:15Z")

</div>

Hi,

I am trying to sum all the values in a column and divide them by 3600.

I used Sum Aggregation in order to sum the values in column(totaluptime)

then in the Advanced section,

I replaced this query,

```auto
{
  "script": {
    "inline": "doc['totaluptime'].value/3600",
    "lang": "painless" 
  }
}

```

the values are not expected. I am not getting the correct values.

Please correct me. Thanks in advance.

real example:  
Sum of the column = 2,032,408.  
after replacing the above query I get is 136. Which is not correct.

The result I should get is 2,032,408/3600 = 564.3

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [September 7, 2021, 9:04am UTC](https://discuss.elastic.co/t/kibana-sum-aggregation-not-showing-the-correct-values-when-i-use-divide-in-json-input/282473/2 "2021-09-07T09:04:38Z")

</div>

Hi @im.manoj,  
could you send me the version of Kibana and visualization config screenshot you're using? I mean this panel:

 ![Screenshot 2021-09-07 at 11.04.24](https://us1.discourse-cdn.com/elastic/original/3X/4/f/4fc96ce8b3da7eee4d9a758e45110303a25424f3.png)

---

<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:** [October 5, 2021, 9:05am UTC](https://discuss.elastic.co/t/kibana-sum-aggregation-not-showing-the-correct-values-when-i-use-divide-in-json-input/282473/3 "2021-10-05T09:05:12Z")

</div>

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