experimental.mode() function

The experimental.mode() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.mode() function computes the mode or value that occurs most often in the _value column in each input table.

Function type: Aggregate

import "experimental"


If there are multiple modes, it returns all of them in a sorted table. Mode only considers non-null values. If there is no mode, experimental.mode() returns null.

Empty tables

experimental.mode() drops empty tables.

Supported data types
  • String
  • Float
  • Integer
  • UInteger
  • Boolean
  • Time


Return the mode of windowed data
import "experimental"

from(bucket: "example-bucket")
  |> filter(fn: (r) =>
    r._measurement == "example-measurement" and
    r._field == "example-field"
  |> range(start:-12h)
  |> window(every:10m)
  |> experimental.mode()

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: