# Get difference of the last hour

**URL:** <https://community.grafana.com/t/get-difference-of-the-last-hour/4851>\
**Category:** InfluxDB\
**Created:** [January 15, 2018, 11:51pm UTC](https://community.grafana.com/t/get-difference-of-the-last-hour/4851 "2018-01-15T23:51:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakob18](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jakob18](https://community.grafana.com/u/jakob18)\
**Post date:** [January 15, 2018, 11:51pm UTC](https://community.grafana.com/t/get-difference-of-the-last-hour/4851/1 "2018-01-15T23:51:15Z")

</div>

Hey,

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?](https://community.grafana.com/t/how-to-value-now-value-some-time-ago-to-see-difference-over-time/483)), 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

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [February 19, 2018, 3:30pm UTC](https://community.grafana.com/t/get-difference-of-the-last-hour/4851/2 "2018-02-19T15:30:50Z")

</div>

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:

- [https://community.influxdata.com/t/server-availability-percentage-value/243](https://community.influxdata.com/t/server-availability-percentage-value/243)
- [https://community.influxdata.com/t/influxdb-query-sum-for-diskio-writes-reads-total/3806/2](https://community.influxdata.com/t/influxdb-query-sum-for-diskio-writes-reads-total/3806/2)

---

<div class="post-metadata">

**Author:** ![priyankagr](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@priyankagr](https://community.grafana.com/u/priyankagr)\
**Post date:** [February 28, 2019, 10:00am UTC](https://community.grafana.com/t/get-difference-of-the-last-hour/4851/3 "2019-02-28T10:00:51Z")

</div>

How can this be done with Graphite data source?
