Data is one day ahead

Hi everyone I have the following query.

from(bucket: "inverterDataTEST")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "${iESS}")
  |> filter(fn: (r) => r["_field"] == "InvTotalEnergyProduced")
  |> aggregateWindow(every: 1d, fn: spread, column: "_value", createEmpty: false)
  |> yield(name: "spread")

The results of the query are correct in that the value of the energy produced is correct. The only problem is that the values are one day ahead of where the should be. So the value for energy produced on Monday is correct but it showing on Tuesday.

I read somewhere about this issue but I cant seem to find the post again

any help would be appreciated

Try to change:

to:

aggregateWindow(every: 1d, fn: spread, column: "_value", createEmpty: false, timeSrc: "_start")

Documentation: aggregateWindow() function | Flux Documentation

timeSrc
Column to use as the source of the new time value for aggregate values. Default is _stop.