influxDB.How to display today's and yesterday’s data on the same panel?

Im using grafana + influxdb, to show data collecting every minute, how can i show yesterday’s data from the same time on the same pannel ? for today’s data im using the query SELECT mean("value") FROM "stal_soc" WHERE $timeFilter GROUP BY time(1m) fill(null)

InfluxDB v2.7.6
Grafana v11.1.0

You can add second query for yesterday’s data into the same panel, i.e. something like this (query should be changed to meet your particular needs):

SELECT mean("value") FROM "stal_soc" WHERE time >= now() - 24h GROUP BY time(1m) fill(null)

1 Like

thanks you for the answer !
i tried that way, but im getting incorrect data, its not from yestarday’s values

That was not a ready copy-paste solution, but rather a direction to move. Main idea was to have two queries - one for yesterday, one for today.

I.e. (again, just examples, not ready-to-use solutions):

SELECT mean("value") FROM "stal_soc" WHERE ("time" > now() - 1d AND "time" < now()) GROUP BY time(1m) fill(null)

and

SELECT mean("value") FROM "stal_soc" WHERE ("time" > now() - 2d AND "time" < now()-1d) GROUP BY time(1m) fill(null)

Also, if you can use flux instead of InfluxQL, that would be much easier to implement. There are several topics at this forum that cover details on this: one, two etc.