Taking ratio of two series in TSVB

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

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?

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