Create daily graph starting at zero (0)

Hi,
Is there a way to have the graph start at zero at the start of each day?

In a energy consumption graph I limit the view to a single day, I would also like the values to be that of that day only.
I use: SELECT mean(“value”) FROM “emeter_delivery” WHERE timeFilter GROUP BY time(__interval) fill(previous)

So instead of the first value being 16006 and increasing during the day, I’d like to have the first value 0 and then increase during the day.
Effectively substracting the value at 00:00 from all other values.
Does anyone know how to do this??
TIAerergygraph

Manually substracting the value read at 00:00 in the query gives the desired result:
SELECT mean(“value”) - 16382 FROM “emeter_delivery” WHERE timeFilter GROUP BY time(__interval) fill(previous)

engraph2

How can I query the value at 00:00 from the db and use it.

The following seems to work. Adding GROUP BY invalidates the query

Rewrote part of query so that grouping is now working as well.
B in yellow is the original query, A (green) the modified one. The scales might be off a bit, but looking at the shape of the graph it looks fine like this.

SELECT CUMULATIVE_SUM(difference) FROM (SELECT DIFFERENCE(mean) FROM (SELECT MEAN(value) FROM emeter_delivery WHERE timeFilter GROUP BY time(__interval) fill(null)))

1 Like