# Divide 2 scripted fields in TSVB

**URL:** <https://discuss.elastic.co/t/divide-2-scripted-fields-in-tsvb/257183>\
**Category:** Kibana\
**Tags:** painless, kql-kibana-query-language\
**Created:** [December 1, 2020, 10:00am UTC](https://discuss.elastic.co/t/divide-2-scripted-fields-in-tsvb/257183 "2020-12-01T10:00:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SwapnilKshirsagar](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@SwapnilKshirsagar](https://discuss.elastic.co/u/SwapnilKshirsagar)\
**Post date:** [December 1, 2020, 10:00am UTC](https://discuss.elastic.co/t/divide-2-scripted-fields-in-tsvb/257183/1 "2020-12-01T10:00:07Z")

</div>

Hi everyone I'm New to Elastic and Kibana.

I am stuck in painless scripting to apply 2 filters on a single index and store them as a 2 different scripted fields. Each scripted field has 2 filters applied on it one is Status other is This\_Month\_Name.

My 1st field (Numerator) is : This\_Month\_Name:1601490600000 and Status:"R"  
My 2nd field (Denominator) is : This\_Month\_Name:1598898600000 and (Status:"N" or Status: "A")

The way I have created a scripted field is this which I guess is not right ;

doc['This\_Month\_Name'].value == 1601490600000L && doc['Status.keyword'].value == 'R'

Then later in TSVB metric tab How to divide these 2 scripted fields in order to get the result.

Would be really great to receive some inputs. 🙂

---

<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 29, 2020, 10:00am UTC](https://discuss.elastic.co/t/divide-2-scripted-fields-in-tsvb/257183/2 "2020-12-29T10:00:08Z")

</div>

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