Fill Missing
Put a value in the blank cells of one column. Copy it from a neighbour row, or type it yourself.
What it does
Fill Missing works on one column. It only touches cells that are empty. Cells that hold a value stay as they are.
You choose one of three methods.
| Method | What it puts in the blank cell |
|---|---|
| literal | A value that you type. |
| forward | The nearest value above the blank cell. |
| backward | The nearest value below the blank cell. |
Fill the blanks
- Type fill in the Search transforms box, in the Pipeline panel.
- Select Fill Missing in the results.
- Open Select column. Pick the column with the blanks.
- Open Method. Choose literal, forward, or backward.
- For literal, type the value in Fill value (for literal).
- For forward or backward, set Sort by (for forward/backward). This step is optional.
- Click Apply.
The panel hides the fields you do not need. The value box only appears for literal.
Forward fill on a meter log
A logger writes the meter name once, then leaves it blank:
| reading_at | meter | kwh |
|---|---|---|
| 09:00 | M-12 | 4.1 |
| 09:15 | 4.4 | |
| 09:30 | 4.2 | |
| 09:45 | M-13 | 1.8 |
Forward fill on meter, sorted by reading_at, gives this:
| reading_at | meter | kwh |
|---|---|---|
| 09:00 | M-12 | 4.1 |
| 09:15 | M-12 | 4.4 |
| 09:30 | M-12 | 4.2 |
| 09:45 | M-13 | 1.8 |
Two blank cells in a row both got M-12. Forward fill carries a value through a whole run of blanks.
Row order decides the result
Forward fill reads upward. Backward fill reads downward. Both depend on the order of your rows.
Leave Sort by (for forward/backward) empty and the current row order applies.
Set a sort column and the fill follows that order instead. Pick a date or a sequence number.
Tips
- Blanks at the top cannot be filled forward. Nothing sits above them. Use backward for those.
- A literal value converts to the column type. Type
0for a number column, notzero. - A value that does not convert leaves the cell empty.
N/Ain a number column fills nothing. - The column keeps its position in the grid.
- Check your work with Filter and the is Empty comparison.
For SQL users
A literal fill on a text column runs as:
SELECT "reading_at", "kwh", COALESCE("meter", 'unknown') AS "meter" FROM "meter_log"
Forward and backward fills use LAST_VALUE or FIRST_VALUE with IGNORE NULLS.
Related Operations
- Join - Join with another file/table
- Unnest - Explode delimited column into rows
- JSON Extract - Extract data in JSON format into columns