integral() function

The integral() function computes the area under the curve per unit of time of subsequent non-null records. integral() requires _start and _stop columns that are part of the group key. The curve is defined using _time as the domain and record values as the range. integral() is an aggregate function.

Output data type: Float

    unit: 10s,
    column: "_value",
    timeColumn: "_time",
    interpolate: "",



(Required) Time duration used when computing the integral.


Column on which to operate. Defaults to "_value".


Column that contains time values to use in the operation. Defaults to "_time".


Type of interpolation to use. Defaults to "".

Use one of the following interpolation options:

  • empty string for no interpolation
  • linear


Input data. Default is piped-forward data (<-).


The following examples use data provided by the sampledata package to show how integral() transforms data.

Calculate the integral

import "sampledata"
    |> range(start: sampledata.start, stop: sampledata.stop)
    |> integral(unit:10s)

View input and output

Calculate the integral with linear interpolation

import "sampledata" true)
    |> range(start: sampledata.start, stop: sampledata.stop)
    |> integral(unit:10s, interpolate: "linear")

View input and output

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.