Hello Elastic community,

I am trying to build a metric in visual builder with 2 aggregations and a Math aggregation below them. But I am getting "Cannot divide by 0".

Below is my structure of data:

sr_number | some_other_column |
---|---|

sr1 | abcd |

sr1 | abcd |

sr1 | abcd |

sr1 | abcd |

sr2 | abcd |

sr2 | abcd |

I want to calculate : (Count of docs / unique of sr_number) .i.e. average per sr.

Below is the error I get when using a visual builder:

Surprisingly the two variables: `params.count_of_events`

and `params.count_of_srs`

have the correct values and work when used in other math functions.

E.g: when using add(a,b)

When using mutitply(a,b)

The variables show values individually too:

Has anyone faced such issues ? Any advice/workarounds is appreciated.

Thank you