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.
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()
Return distinct values from a non-default column
import "sampledata"
sampledata.int()
|> distinct(column: "tag")
Return distinct values from with null values
import "sampledata"
sampledata.int(includeNull: true)
|> distinct()
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.