distinct() function

The distinct() function returns the unique values for a given column. The _value of each output record is set to the distinct value in the specified column. null is considered its own distinct value if it is present.

*Function type: Selector
**
Output data type:* Record

  1. distinct(column: "host")

Empty tables

distinct() drops empty tables.

Parameters

column

Column on which to track unique values.

*Data type: string*

Examples

  1. from(bucket: "example-bucket")
  2. |> range(start: -5m)
  3. |> filter(fn: (r) => r._measurement == "cpu")
  4. |> distinct(column: "host")

Related articles