How to present the last daily value?

Hey! Ok so I have a energy sensor that resets each day. How do I only present the last value?

How do you define “the last daily value?”
Seeing the image it actually shows the first value of the day


So here on the 29th we see one @ 00:00:00 and a another at 12:00

Hm no at 00:00 its at 0 kWh since this helper does resets at the start of each day. So I simply want the value before each reset.
The sensor do have a “last_period” attribute I could use I guess in creating a custom template sensor with. But is there no simple way to extract this in Grafana maybe?

look t this thread. the answer by @alexandrearmand might be of help with that last() function

1 Like

you are right it is the same asking, check the link
fast aswer : add this line to your query
|> aggregateWindow(every: 1d, fn: last)

1 Like

Sorry I wanted to use Grafana for its by the look no need to be a coder :slight_smile:
So where/how do I add this code? I tried add the code you wrote as a new line below the rest of the code when I pressed “pen” in the right side of the Query.
It does however give me an error…

Am I doing something wrong?

so you are using influxql and not flux. what @alexandrearmand provided you is flux query. for your influx ql query you might want to look into