Documentation

highestAverage() function

The highestAverage() function calculates the average of each table in the input stream returns the top n records. The function outputs a single aggregated table containing n records. highestAverage() is a selector function.

highestAverage(
    n:10,
    column: "_value",
    groupColumns: [],
)

Empty tables

highestAverage() drops empty tables.

Parameters

n

Number of records to return.

column

Column by which to sort. Default is "_value".

groupColumns

The columns on which to group before performing the aggregation. Default is [].

tables

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

Examples

The following example uses data provided by the sampledata package to show how highestAverage() transforms data.

import "sampledata"

sampledata.int()
    |> highestAverage(n: 2, groupColumns: ["tag"])

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.