Subtract two queries

I am pretty sure this has been asked before, but none of the responses I found helped me.

I basically have two measures for each day (“sleep_start” and “sleep_stop”), each containing a Unix timestamp. I would like to plot the difference for each pair, which will be in minutes. The data comes from an activity tracker, and each timestamp is the moment I went to sleep and the moment I woke up, respectively.

(e.g.:
2020-01-03,1578013080,1578033360
2020-01-04,1578097440,1578125280
2020-01-05,1578184680,1578218580
)

Grafana reads the two measurements from an influxdb database.

1 Like