Hi,

the graph shows a cumulative kWh value over the day. The value is set to 0 at 0:00 each night. I would like to calculate the kWh each day in a specific time period from 10:00-16:00. Because it is a cumulative value already which is summed up by homewizard, my approach is to calculate a delta (16:00 value minus 10:00 value). How could I solve this with flux?

My approach was:

```
import "date"
import "timezone"
option location = timezone.location(name: "Europe/Berlin")
data1 = from(bucket: "homey-downsample")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Wattcher")
|> filter(fn: (r) => r["_field"] == "meter_power")
until_16 = data1
|> filter(fn: (r) => {hour = date.hour(t: r._time) return hour == 16})
|> aggregateWindow(every: 1d, offset: -1s, fn: max, createEmpty: false)
|> set(key: "_field", value: "delta")
until_10 = data1
|> filter(fn: (r) => {hour = date.hour(t: r._time) return hour == 10})
|> aggregateWindow(every: 1d, offset: -1s, fn: max, createEmpty: false)
|> set(key: "_field", value: "delta")
union(tables: [until_16, until_10])
|> difference()
|> aggregateWindow(every: 1d, offset: -1s, fn: max, createEmpty: false)
```

But it doesnâ€™t work and I do not trust the result.

THX for your help in advance!