New to Influxdb Grafana query

@myozone
difference() returns the difference between subsequent values. You are querying a whole day’s worth of readings, so you need to use the spread() function as previously described. Also, there is a way in Flux to specify yesterday (Grafana too, but let’s focus on Flux).

Something like this should work:

import "experimental/date/boundaries"

day = boundaries.yesterday()

from(bucket: "buckett")
|> range(start: day.start, stop: day.stop)
  |> filter(fn: (r) => r["_measurement"] == "kwh")
  |> filter(fn: (r) => r["_field"] == "kwh")
  |> spread()
  |> yield(name: "stat_for_yesterday_kwh")
1 Like