Documentation

distinct() function

Flux 0.7.0+

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. distinct() is a selector function.

distinct(column: "host")

Empty tables

distinct() drops empty tables.

Parameters

column

Column to return unique values from. Default is _value.

tables

Input data. Default is piped-forward data (<-).

Examples

The following examples use data provided by the sampledata package to show how distinct() transforms data.

Return distinct values from the _value column

import "sampledata"

data = sampledata.int()

data
  |> distinct()

View input and output

Return distinct values from a non-default column

import "sampledata"

sampledata.int()
  |> distinct(column: "tag")

View input and output

Return distinct values from with null values

import "sampledata"

sampledata.int(includeNull: true)
  |> distinct()

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.