difference() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.50 is the most recent stable version of Flux.

The difference() function computes the difference between subsequent non-null records.

Function type: Aggregate
Output data type: Float

difference(nonNegative: false, columns: ["_value"])

Parameters

nonNegative

Indicates if the difference is allowed to be negative. When set to true, if a value is less than the previous value, it is assumed the previous value should have been a zero.

Data type: Boolean

columns

A list of columns on which to compute the difference. Defaults to ["_value"].

Data type: Array of strings

Examples

from(bucket: "telegraf/autogen")
  |> range(start: -5m)
  |> difference()
from(bucket: "telegraf/autogen")
  |> range(start: -5m)
  |> difference(nonNegative: true)

DIFFERENCE()