How do I calculate a peak to low value?

Hello, I need some help calculating a peak to low value over a period of time.
I have influxdb. Let’s say over the past 3 seconds I have the following values. 2000, 1000, 1500, 100, -300

The max is 2000 and the min is -300.

My peak to low value is 2300.

I’d like to display this as a single stat. Can it be done?

thanks, Rob

SELECT max(“your_metric”) - min(“your_metric”) FROM “your_measurement” WHERE $timeFilter GROUP BY time($interval) fill(null)
as query should be what you are looking for!?

1 Like