I’m trying to work out how to subtract one singlestat value from another, to display the difference as a third value.
What I’m aiming for is a way to show 6 different singlestat values, each one showing the sum of a measurement for “yesterday”, “the day before yesterday”, “the day before that” and so on.
I’ve figured out that I can use Grafana’s “Time range” tab in the query builder to get the sum for yesterday with an “override” of “now/d” and a “time shift” of “1d”. I can’t figure out how to get the day before yesterday, but I can get both added together with an “override” of “now/d” and a “time shift” of “2d”, so if I can subtract the first calculated value from the second one, that will give me the answer I want, for the day before yesterday.
And so on.
I’ve tried an “override” of “now-1d/d” and “now/d-1d” but these get deleted and reset to empty.
I’m using InfluxDB as the data source, so I know that I can’t do any maths operations such as % (remainder) on time values, so I don’t think there’s any way of getting “the start of yesterday” and “the end of yesterday” into a query statement…
Does anyone have any ideas or solutions to this problem?