INFLUXDB 1.8, Select without today


I would like the average value of electricity consumption over the last 7 days without the current day (today).

What I have:
SELECT difference(last(“Default”)) FROM “Zaehler180Bezug” WHERE $timeFilter GROUP BY time(1d,-1h) fill(null)
(and I divide this value by 7)

However, this distorts the result because the value for today is included in the calculation.
In the evening at 11:30 p.m. this is no longer so dramatic, but in the morning at 7:00 a.m. it distorts the result considerably.

What should the query look like so that the current day is not taken into account and the difference between (current day - 8 days) and (current day - 1 day) is formed.

InfluxDB has no clue about what a day is, time is just an endless counter and any time unit (d,h,m) just translates to numbers.

InfluxDB itself doesn’t have a built-in way of excluding the current day, but that might be done by outer tools, from your syntax I’d say you are using Grafana… if that’s the case I’m not aware of a way of doing it except just selecting the date range you want

If you are calculating a consumption rate the function derivative (with time unit option) may come in handy.