# Sum aggregation in scripting (Kibana Visualization)

**URL:** <https://discuss.elastic.co/t/sum-aggregation-in-scripting-kibana-visualization/58325>\
**Category:** Kibana\
**Created:** [August 18, 2016, 7:51am UTC](https://discuss.elastic.co/t/sum-aggregation-in-scripting-kibana-visualization/58325 "2016-08-18T07:51:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheeba](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@sheeba](https://discuss.elastic.co/u/sheeba)\
**Post date:** [August 18, 2016, 7:51am UTC](https://discuss.elastic.co/t/sum-aggregation-in-scripting-kibana-visualization/58325/1 "2016-08-18T07:51:09Z")

</div>

In data table visualization, We have created a new metric with the script as { "script" : "doc['field'].value \* 2 " }

Whether the total of this new metric can be found in Kibana using sum aggregation in JSON Input script? Like sum of "doc['field'].value \* 2 " to show the total value in the visualization.

How to add sum aggregation in json input?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [August 18, 2016, 11:14pm UTC](https://discuss.elastic.co/t/sum-aggregation-in-scripting-kibana-visualization/58325/2 "2016-08-18T23:14:39Z")

</div>

You shouldn't have to add any custom JSON. The scripted field should show up in the list of fields. Does it not show up for you?

---

<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:** [July 6, 2017, 1:40pm UTC](https://discuss.elastic.co/t/sum-aggregation-in-scripting-kibana-visualization/58325/3 "2017-07-06T13:40:49Z")

</div>


