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

distinct(column: "host")

Empty tables

distinct() drops empty tables.



Column to return unique values from. Default is _value.


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


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 =

    |> distinct()

View input and output

Return distinct values from a non-default column

import "sampledata"
    |> distinct(column: "tag")

View input and output

Return distinct values from with null values

import "sampledata" true)
    |> distinct()

View input and output

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.