Query cumulative sum
to calculate a running total of values.
cumulativeSum sums the values of subsequent records and returns each row updated with the summed total.
Given the following input table:
The examples below use the example data variable.
Calculate the running total of values
data |> cumulativeSum()
Use cumulativeSum() with aggregateWindow()
segments data into windows of time, aggregates data in each window into a single
point, then removes the time-based segmentation.
It is primarily used to downsample data.
aggregateWindow() expects an aggregate function that returns a single row for each time window.
then calculate the running total of the aggregate values with
data |> aggregateWindow(every: 5m, fn: sum) |> cumulativeSum()
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.