Get difference of the last hour


I have following graph:
SELECT mean(“value”) FROM “network_value” WHERE (“type_instance” = ‘totalbytesreceived’) AND $timeFilter GROUP BY time($__interval) fill(null)

I now want Grafana to show (in one number) how much the value has changed in the last 60 minutes. I’ve tried different solution (a.e. from How to: value(now) - value(some time ago) to see Difference over time?), but they showed wrong values. Can’t you just do ($“value from now” - $“value from 60min ago”)?

Thanks for your help!

Edit: Another option may be to:

  1. Select all values from the last 60 minutes
  2. Take the minimum value and subtract it from the maximum value (the values only go up in my graph)
  3. Return that as a result

It’s a bit tricky with InfluxDB (compared to Graphite and Prometheus) but it is possible. You will have to switch to raw query mode. Maybe these links will help you figure it out:

How can this be done with Graphite data source?