2

I have a photovolatic system and log the generated electricity in KwH at each change in an InfluxDB 2.0.

Now I want to have a graph of the monthly yields in Grafana. For this I need to load the last value of the day and sum it up per month. Actually a simple query, but unfortunately I can't get it implemented.

The following query I tried and expected it to work:

from(bucket: "Home Assistant") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "sensor.kaco_29") |> filter(fn: (r) => r["_field"] == "kwh_today") |> aggregateWindow(every: 1d, fn: last) |> aggregateWindow(every: 1m, fn: sum) 

Loading the last daily value works, without the last line without any problems. How do I get the data summed up per month?

1 Answer 1

0

Did you try grouping after the first aggregation?

Add

|> group() 

between the two aggregateWindow() functions.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.