<!-- https://learnsql.cpetoday.com/functions/m/table-filldown -->
# Table.FillDown

Language: Power Query M
Category: Table: values and fill
Syntax: Table.FillDown(table as table, columns as list) as table
Summary: Fills blank cells in the listed columns with the value from the row above.
Returns: The table with blanks filled down.
Level: Beginner
Related: Table.FillUp, Table.ReplaceValue, Table.PromoteHeaders, Table.Group

## What it does
Many reports show a label once for a block of rows. In Excel this is a merged cell, and only the first row has the account name. Table.FillDown copies the last filled value downward into the blank cells below, so every row carries its label. It is the first thing to do with a grouped export.

## Syntax and arguments
- **table**: the table to change. Required.
- **columns**: a list of column names in braces. Each column is filled separately. Required.

## Example
A general ledger export lists the account name only on the first line of each account. Every row is filled down with the account name, so the postings can be summarized by account.

```powerquery
let
    Source = Excel.CurrentWorkbook(){[Name = "GLExport"]}[Content],
    Filled = Table.FillDown(Source, {"Account Name"})
in
    Filled
```

Each blank Account Name takes the name from the nearest row above it. The rows keep their own amounts.

## Example: a second, different use
A budget sheet has a department name only on the first row of each block, and some rows below it are blank. Both the department and the period are filled down.

```powerquery
let
    Source = Excel.CurrentWorkbook(){[Name = "BudgetByDept"]}[Content],
    Filled = Table.FillDown(Source, {"Department", "Period"})
in
    Filled
```

## Things to watch
- Only blank cells (null) are filled. A cell with a space is not blank, so trim spaces first if the export leaves them.
- Fill works on the current order. Sort the rows first if the blocks are out of order, or the value will come from the wrong row.
- Total or subtotal rows may have a blank label too. They will take the label above them. Remove them after you have filled, using a rule you can explain.
- Query folding: this step usually breaks folding, so place it after the steps that filter rows on the database.

## In business terms
Account and department labels that appear once per group are the norm in ledgers, budgets and aging reports. Filling them down is the step that turns a formatted report into a table you can summarize.
