# Create Pie Chart for Agg of 2 fields

**URL:** https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710
**Category:** Kibana
**Created:** [May 23, 2016, 12:21pm UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710 "2016-05-23T12:21:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chenbe2204](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chenbe2204](https://discuss.elastic.co/u/chenbe2204)
#### Post date: [May 23, 2016, 12:21pm UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710/1 "2016-05-23T12:21:46Z")

</div>

Hi ,

My index contain the following fields:  
rb\_commit  
git\_commit

I want my Pie chart will contain the sum of each one of the fields , that means the pie chart will be separate for 2 parts (to the sum of rb\_commits and the sum of git\_commits).  
In the aggregation part at the Chart , I can choose only 1 Field .  
How can I do it in Kibana ?

BR,  
Chen

---

<div class="post-metadata">

### Author: ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)
#### Post date: [May 23, 2016, 5:06pm UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710/2 "2016-05-23T17:06:29Z")

</div>

The only way to create the sum of these fields (without creating a new field) is to use a scripted field. This field could just include the sum of both fields:

`doc['rb_commit'].value + doc['git_commit'].value`

---

<div class="post-metadata">

### Author: ![chenbe2204](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chenbe2204](https://discuss.elastic.co/u/chenbe2204)
#### Post date: [May 24, 2016, 5:04am UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710/3 "2016-05-24T05:04:14Z")

</div>

Hi ,  
I created the scripted field , it contain the correct sum of both of fields.  
But how can I create my Pie Chart that will be separate for sum of all rb\_commit and sum of git\_commit ?  
For example:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/3e0f1882d50c1e5a0c7b2f968b24b1ede70c74f2.png)  
The red part is rb\_commit and the green part is git\_commit,  
Thanks 🙂

Chen

---

<div class="post-metadata">

### Author: ![chenbe2204](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chenbe2204](https://discuss.elastic.co/u/chenbe2204)
#### Post date: [May 29, 2016, 6:37am UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710/4 "2016-05-29T06:37:05Z")

</div>

Hi ,  
Can you help me with that issue ?  
Thanks 🙂

Chen

---

<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:52pm UTC](https://discuss.elastic.co/t/create-pie-chart-for-agg-of-2-fields/50710/5 "2017-07-06T13:52:04Z")

</div>


