# Divide 2 metrics in kibana

**URL:** <https://discuss.elastic.co/t/divide-2-metrics-in-kibana/205378>\
**Category:** Kibana\
**Created:** [October 27, 2019, 8:16am UTC](https://discuss.elastic.co/t/divide-2-metrics-in-kibana/205378 "2019-10-27T08:16:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_Mousavi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammad_mousavi/32/56508_2.png) [@Mohammad\_Mousavi](https://discuss.elastic.co/u/Mohammad_Mousavi)\
**Post date:** [October 27, 2019, 8:16am UTC](https://discuss.elastic.co/t/divide-2-metrics-in-kibana/205378/1 "2019-10-27T08:16:48Z")

</div>

Hi. I have 2 metrics that shows unique count of users and total streamed time.  
I wanna have avg streamed time per client.

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/8/1/81ce994900d12aec2f99e6f3b719ecf02496dcc7.png)  
How can I divide these 2 metrics ? some pipeline aggregation or script ? Thanx a lot

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [October 28, 2019, 5:41pm UTC](https://discuss.elastic.co/t/divide-2-metrics-in-kibana/205378/2 "2019-10-28T17:41:29Z")

</div>

Hi if your index has a time field, then you can use TSVB and apply a bucket script between the two aggregations like in this example:

 ![47](https://us1.discourse-cdn.com/elastic/original/3X/5/2/52c74e8dd22f1a55be3c722546e308a7f391d4f5.png)

Keep in mind that TSVB displays the last available bucket, so if you have to cover fully your time range you should change the `interval` in the `Panel Options` to something larger than the time range you wanna use on your dashboard.  
Starting from version 7.4 it's a bit more easy to configure TSVB to display the value time range.

---

<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:** [November 25, 2019, 5:41pm UTC](https://discuss.elastic.co/t/divide-2-metrics-in-kibana/205378/3 "2019-11-25T17:41:39Z")

</div>

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