I am creating a line visualisation using Kibana Visual builder.

I defined two SUM aggregations on fields ingestedsize and primarystore.

Based on these two values I want to display % line.

For this I used Math aggregation, and defined two variables as show in below figure and used the expression to calculate the percentage.

But I am getting error "cannot divide by zero".

If I understand correctly, for any bucket, if the ps1 is zero we are getting the error. Is there any way to check if it is grater than 0 in expression.

Hope I am able to explain the problem, if you need any further details please let me know.