Function that calculates increasing values instead of delta

I have a counter table which counts certain data per day (like number of requests). I have defined a time series graph in grafana that shows the request per days.

Data looks like that:
1.03.2024 4
2.03.2024 6
3.03.2024 2

Sql query looks like this:

SELECT SUM(count), timestamp FROM counter WHERE $__timeFilter(timestamp) GROUP BY timestamp

That works so far but now i would like that the graph shows the absolute/increasing values and not the delta. The data point in the graph should be like that:

1.03.2024 4
2.03.2024 10
3.03.2024 12

Is there a build in function in grafana that adds the previous values to the current value in a time series graph? Is there an other way to achieve this in grafana/sql or do i have to count the total value in the counter table as a separate field?

Grafana 10.3.x and postgresql is used

thank you

That’s not a task for Grafana but for your SQL. I think you want to have rate visualized, so search how to calculate it then. Random Google result for inspiration: sql - Calculating rates in PostgreSQL - Stack Overflow

ok, than it’s probably better to have a total counter as a table field and count the total amount continiously. thank you