fill() function

The fill() function replaces all null values in an input stream with a non-null value. The output stream is the same as the input stream with all null values replaced in the specified column.

fill(column: "_value", value: 0.0)

// OR

fill(column: "_value", usePrevious: true)



The column in which to replace null values. Defaults to "_value".


The constant value to use in place of nulls. The value type must match the value type of the column.


When true, assigns the value set in the previous non-null row.

Cannot be used with value.


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


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

Fill null values with a specified non-null value

import "sampledata"

sampledata.float(includeNull: true)
    |> fill(value: 0.0)

View input and output

Fill null values with the previous non-null value

import "sampledata"

sampledata.float(includeNull: true)
    |> fill(usePrevious: true)

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.