# Simple operations on count result

**URL:** <https://discuss.elastic.co/t/simple-operations-on-count-result/106013>\
**Category:** Kibana\
**Created:** [November 1, 2017, 9:56am UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013 "2017-11-01T09:56:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyr](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jeremyr](https://discuss.elastic.co/u/jeremyr)\
**Post date:** [November 1, 2017, 9:56am UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013/1 "2017-11-01T09:56:40Z")

</div>

Hi All,

Simple question but I can't find a simple answer : I would like to know, if there a way to apply a simple math operation on count result like multiplication or division. ( Kibana 5.6.3)

I tried to add a script\_fields on JSON input by following the documentation but it does not work...

My goal is to multiply this result ( see Example below)

 ![08](https://us1.discourse-cdn.com/elastic/original/3X/5/9/597c056ba1ba933eb183fbf01f52a15ac5fe2a11.png)

Thanks for your help

J.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [November 1, 2017, 8:01pm UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013/2 "2017-11-01T20:01:51Z")

</div>

you could achieve it by scripted fields. In the screen shot below I have selected the Aggregation: Sum and field as count\_field: This gives you the count of the docs. ![Pasted image at 2017_11_01 03_33 PM (1)](https://us1.discourse-cdn.com/elastic/original/3X/2/7/271e78841487206f4486897f91288134482d58c1.png)

Now add a scripted field like shown below where you can apply mathematical calculations on the fields:

 ![Pasted image at 2017_11_01 03_33 PM](https://us1.discourse-cdn.com/elastic/original/3X/2/1/211549b2195352604816d5e102a455218768edfd.png)

This way you can achieve what you wanted multiply the result .

Hope this helps  
Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![jeremyr](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jeremyr](https://discuss.elastic.co/u/jeremyr)\
**Post date:** [November 7, 2017, 2:54pm UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013/3 "2017-11-07T14:54:22Z")

</div>

Thanks, works perfectly.

J.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [November 7, 2017, 3:21pm UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013/4 "2017-11-07T15:21:46Z")

</div>

Thanks for updating the thread.

Cheers  
Rashmi

---

<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:** [December 5, 2017, 3:21pm UTC](https://discuss.elastic.co/t/simple-operations-on-count-result/106013/5 "2017-12-05T15:21:59Z")

</div>

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