Display daily solar yield of last 14d

I cannot fix my problem, converting an InfluxQL to Flux after upgrading to Influx 2.x and Grafana 9.x

This was the window I had previously:


SELECT Integral(“opwek_kwh”,1h) FROM (SELECT (value) AS “opwek_kwh” FROM “PV-opwek”) WHERE $timeFilter GROUP BY time(1d)

I now have this query in Flux but that does not work. I only get the past 24h value, NOT the value from midnight and or daily values.

from(bucket: “energy”)
|> range(start: -14d, stop: now())
|> filter(fn: (r) => r[“_measurement”] == “youless”)
|> filter(fn: (r) => r[“_field”] == “Wh”)
|> filter(fn: (r) => r[“counter”] == “actual”)
|> filter(fn: (r) => r[“source”] == “solar”)
|> aggregateWindow(every: 1d, fn: last, createEmpty: true)
|> integral(unit: 1h)
|> yield(name: “test”)

I’m busy searching for days now in forums and via Google but I can’t fix this…
Thanks for any help!

1 Like

Can you share the output of this query from Influx Data Explorer for this query? Just a screenshot to see the data being returned should be sufficient.