From 51fab5fbf3379e98c3b2752654667f47970bc8a9 Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Sat, 30 Nov 2024 02:29:58 +0100 Subject: [PATCH] reset average value to 0.0 if all values in serie are absent --- pkg/expr/helper/helper.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/expr/helper/helper.go b/pkg/expr/helper/helper.go index d90c1ac1..3a2cf275 100644 --- a/pkg/expr/helper/helper.go +++ b/pkg/expr/helper/helper.go @@ -210,6 +210,8 @@ func SummarizeValues(f string, values []float64, absent []bool) (float64, bool, } if total > 0 { rv /= float64(total) + } else { + rv = 0.0 } case "max": rv = math.Inf(-1)