Documentation

mode() function

The mode() function computes the mode or value that occurs most often in a specified column in the input table.

Function type: Aggregate

mode(column: "_value")

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, mode() returns null.

Empty tables

mode() drops empty tables.

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

Parameters

column

The column to use to compute the mode. Defaults to "_value".

Data type: String

Examples

Return the mode of windowed data
from(bucket: "example-bucket")
  |> filter(fn: (r) =>
    r._measurement == "errors" and
    r._field == "count_per_minute"
  )
  |> range(start:-12h)
  |> window(every:10m)
  |> mode()

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: