Grafana - Plotting difference between data points in Timescale DB

So we have some data, that we want to plot. But we do not want the exact data, we would like to calculate and plot the difference between the data points. We thought we could use “Reduce Row” for this, but actually it does not work ;/ Does someone has any idea how to solve this problem? We use Timescale DB Data :slightly_smiling_face:

I’m not exactly sure why it’s called “Binary operation” (i didn’t name it!), but it looks you’re close?

Yes, but i want to calculate the difference from one data point. So if at t0 the consumption is 5000 and at t1 the consumption is 5500, I want to plot the difference :slightly_smiling_face:

With SQL you can probably get this done with OVER window functions

https://en.wikipedia.org/wiki/Window_function_(SQL)
https://docs.timescale.com/timescaledb/latest/how-to-guides/query-data/advanced-analytic-queries/