elapsed() function

The elapsed() function returns the time between subsequent records. Given an input table, elapsed() returns the same table without the first record (as elapsed time is not defined) and an additional column containing the elapsed time.

Function type: Transformation

  unit: 1s,
  timeColumn: "_time",
  columnName: "elapsed"

elapsed() returns an errors if the timeColumn is not present in the input table.



The unit time to returned. Defaults to 1s.

Data type: Duration


The column to use to compute the elapsed time. Defaults to "_time".

Data type: String


The column to store elapsed times. Defaults to "elapsed".

Data type: String


Calculate the time between points in seconds
from(bucket: "example-bucket")
	|> range(start: -5m)
	|> elapsed(unit: 1s)

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: