Time Series showing cumulative delta over the selected time range?

Question best illustrated with a diagram:


I have data in Prometheus which tracks a financial balance over time. I’d like to graph the delta as of the beginning of the chosen Grafana dashboard timeframe.

So, the graph should always start from y-axis zero.

I’ve tried a few different functions e.g. rate, delta, value - value offset $__range etc, but these don’t seem to achieve what I want.

Suggestions appreciated.

Grafana v9.0.5

I have found an answer which works, although it’s pretty complex:

- avg_over_time(
      my_metric and on() vector(time()) >= $__from/1000 < $__from/1000+$__interval_ms/1000
1 Like