Time queries in Grafana


I have an influxdb database where data from my smart meter is stored via node-red. I have some nice Grafana Dashoboards and happy so far.
There is only one thing i can´t find any information about. I want the total consumption of the last day.
I know it is possible to say the last 24h or from 2021-02-01 00:00 to 2021-02-01 23:59

What i want is the graph always displaying the day before from 00:00 to 23:59. I do not want to do this manually via the absolute time range as only this graph should show this information.

Anyone any hint how i can do this?


Try From = “now-1d/d” and To = “now-1d/d”


It shows me “NO DATA”
i guess it´s an syntax error

SELECT difference(mean(“value”)) FROM “tele/tasmota_D12486/total_in” WHERE $timeFilter GROUP BY time(From = “now-1d/d” and To = “now-1d/d”) fill(null)

If you want to modify the raw query itself then you need to replace $timefilter
with the appropriate expression, however what I had meant was that you use the
graphical query builder and set both the “From” and “To” fields to “now-1d/d”.


I´m happy to use the graphical query builder. But i have nearly 0 knowledge and i can find the FROM field but not the TO. Can you help maybe with a screenshot?

As per screenshot attached. Everything works fine when i add the time range under point 1

What i want is that all graphs changes with the time settings under 1 EXCEPT graph number 2. Graph number 2 should always show the day before from “00:00 to 23:59”
how can i do this?

any help or tip is welcome

If I understand correctly, you want to time shift your single stat panel at #2.

If this is Grafana v7, above the query should be a pull down menu with “Query Options”. Show the options and enter “1d” into the text box with label “Time shift”. (You might want to select “Hide time info”, too.)

To show the time stamps, I created a table with data grouped by 1h. I put the two tables next to each other. You can see that the data samples were shifted by 24 hours…

Hopefully, this works for you.

1 Like

Thanks, but the time shift function is not what i´m searching.
I want figure two to always show “yesterday 00:00 to yesterday 23:59” no matter what i enter in the absolute timerange