# Mathematical relation of numeric fields as value for Split Slices

**URL:** <https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971>\
**Category:** Kibana\
**Created:** [April 20, 2017, 3:13am UTC](https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971 "2017-04-20T03:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasina](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@vasina](https://discuss.elastic.co/u/vasina)\
**Post date:** [April 20, 2017, 3:13am UTC](https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971/1 "2017-04-20T03:13:45Z")

</div>

Hi all!

I want to use mathematical relation of two numeric fields for split slices in Pie Chart (field1/field2 as field in Terms sub aggregation). Can I do it? Is there any way to do it with painless script in "Advanced" for split slices ?

Sorry for my bad English!

Thanks,  
Darya

---

<div class="post-metadata">

**Author:** ![Stacey\_Gammon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stacey_gammon/32/14025_2.png) [@Stacey\_Gammon](https://discuss.elastic.co/u/Stacey_Gammon)\
**Post date:** [April 20, 2017, 10:51am UTC](https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971/2 "2017-04-20T10:51:58Z")

</div>

You can do this with a painless scripted field. Head over to the `Management` app, click `Index Patterns`, make sure your index is selected, and select the `scripted fields` tab. There you can add a new scripted field using a mathematical calculation:

 ![](https://us1.discourse-cdn.com/elastic/original/3X/f/a/faeb7bbcd8f7f3534d5b320ccd42354e9ebf126d.png)

Once you've created your new numeric field, you can use it in a pie chart:

 ![](https://us1.discourse-cdn.com/elastic/original/3X/5/0/501b42a790569b90328fcb0e85f5034d05e9d2e7.png)

BTW, your english was just about perfect. 🙂

---

<div class="post-metadata">

**Author:** ![vasina](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@vasina](https://discuss.elastic.co/u/vasina)\
**Post date:** [April 20, 2017, 11:01am UTC](https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971/3 "2017-04-20T11:01:12Z")

</div>

Thank you so much, @Stacey_Gammon !

---

<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:** [May 18, 2017, 11:06am UTC](https://discuss.elastic.co/t/mathematical-relation-of-numeric-fields-as-value-for-split-slices/82971/4 "2017-05-18T11:06:57Z")

</div>

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