# Taking ratio of two series in TSVB

**URL:** <https://discuss.elastic.co/t/taking-ratio-of-two-series-in-tsvb/368256>\
**Category:** Kibana\
**Created:** [October 4, 2024, 2:23pm UTC](https://discuss.elastic.co/t/taking-ratio-of-two-series-in-tsvb/368256 "2024-10-04T14:23:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smondal](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@smondal](https://discuss.elastic.co/u/smondal)\
**Post date:** [October 4, 2024, 2:23pm UTC](https://discuss.elastic.co/t/taking-ratio-of-two-series-in-tsvb/368256/1 "2024-10-04T14:23:59Z")

</div>

I am trying to create a line chart in TSVB which is the ratio of "Numerator" and "Denominator" defined as follows:

1. Added a series called "Numerator" by first creating a metric with aggregation = "Cardinality" on a field "x.keyword" group by "Everything", followed by creating another metric on top with aggregation = "Series Agg" and function = "Sum"
2. Added another series called "Denominator" by first creating a metric with aggregation = "Max" on a field "y.keyword" group by "Terms" by "z.keyword" field, followed by creating another metric on top with aggregation = "Series Agg" and function = "Sum"

Both numerator and denominator are created on the same index and final line charts look something like

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

What I want is a ratio of these two numbers over the timeline. But the Math aggregation is turned off when I try to create another series. What can be a possible solution?

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [November 15, 2024, 2:17pm UTC](https://discuss.elastic.co/t/taking-ratio-of-two-series-in-tsvb/368256/2 "2024-11-15T14:17:37Z")

</div>

Hi there, could you try Lens formula to achieve what you intend in this issue?
