# Manually Calculate Terms within a bar chart

**URL:** <https://discuss.elastic.co/t/manually-calculate-terms-within-a-bar-chart/35745>\
**Category:** Kibana\
**Created:** [November 27, 2015, 10:59am UTC](https://discuss.elastic.co/t/manually-calculate-terms-within-a-bar-chart/35745 "2015-11-27T10:59:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)\
**Post date:** [November 30, 2015, 12:54pm UTC](https://discuss.elastic.co/t/manually-calculate-terms-within-a-bar-chart/35745/4 "2015-11-30T12:54:53Z")

</div>

Yup - that should be simple enough with a scripted field.

Simply go to Settings  
choose your index and click on Scripted fields.  
Click "Add scripted field" and enter a name for the field  
Define your script , which should be "doc['status1'].value - doc['status2'].value"

Done - you should now have a status3 field to use.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/7/75809a61513a144c569d34ba15f450a5762a1a1e.png)

---

_[View the full topic](https://discuss.elastic.co/t/manually-calculate-terms-within-a-bar-chart/35745)._
