---
title: experimental.fill() function
description: experimental.fill() replaces all null values in the _value column with a non-null value.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/fill/
estimated_tokens: 2370
product: Flux
version: v0
---

# experimental.fill() function

-   Flux 0.112.0+
-   View InfluxDB support

`experimental.fill()` is [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`experimental.fill()` replaces all null values in the `_value` column with a non-null value.

##### Function type signature

```js
(<-tables: stream[{B with _value: A}], ?usePrevious: bool, ?value: A) => stream[{B with _value: A}]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### value

Value to replace null values with. Data type must match the type of the `_value` column.

### usePrevious

Replace null values with the value of the previous non-null row.

### tables

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

## Examples

-   [Fill null values with a specified non-null value](#fill-null-values-with-a-specified-non-null-value)
-   [Fill null values with the previous non-null value](#fill-null-values-with-the-previous-non-null-value)

### Fill null values with a specified non-null value

```js
import "experimental"
import "sampledata"

sampledata.int(includeNull: true)
    |> experimental.fill(value: 0)
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z |  | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z |  | t1 |
| 2021-01-01T00:00:40Z |  | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z |  | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z |  | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |

#### Output data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 0 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 0 | t1 |
| 2021-01-01T00:00:40Z | 0 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | 0 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 0 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |

### Fill null values with the previous non-null value

```js
import "experimental"
import "sampledata"

sampledata.int(includeNull: true)
    |> experimental.fill(usePrevious: true)
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z |  | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z |  | t1 |
| 2021-01-01T00:00:40Z |  | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z |  | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z |  | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |

#### Output data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | -2 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 7 | t1 |
| 2021-01-01T00:00:40Z | 7 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z |  | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 19 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |

#### Related

-   [Fill null values in data](/influxdb/v2/query-data/flux/fill/)
-   [fill() function](/flux/v0/stdlib/universe/fill/)
-   [InfluxQL – FILL](/influxdb/v1/query_language/explore-data/#group-by-time-intervals-and-fill)

[transformations](/flux/v0/tags/transformations/)
