Power Query Table.FillUp: Step-by-Step Guide
In this article
Table.FillUp fills blank cells in a column with the value from the row below, working upward. It is the mirror image of Table.FillDown, which fills downward from the row above. Use it when your data has a label or category that appears only at the bottom of a group and you need it repeated up the group. You do not need any add-in: Table.FillUp is a built-in Power Query M function available in Excel's Get & Transform and in Power BI Desktop. The main prerequisite is a query that already loads the table you want to fix, plus a column where the blanks are genuinely empty nulls rather than empty text strings.
What You'll Need
- Excel with Power Query (Data > Get Data) or Power BI Desktop. Menu labels can differ slightly by version, device and region.
- A query that already connects to your source table.
- A column that contains null values you want to replace with the value from the row below.
- Basic familiarity with the Power Query Editor and the formula bar.
Step-by-Step
- Open the Power Query Editor. In Excel, select any cell in your table and go to Data > From Table/Range, or open an existing query from Data > Queries & Connections. In Power BI Desktop, use Home > Transform data.
- Confirm the column you want to fill is the correct data type. Select the column header and check the icon on the left of the header. If the blanks are showing as the text "null" rather than a true null, the function will not treat them as empty. To convert, right-click the column header and choose Change Type > Text (or the type you need), then use Transform > Replace Values to replace the literal text with null if necessary.
- Make sure the rows are in the order you want the fill to follow. Table.FillUp reads upward from the bottom of the table, so if your groups are sorted differently the fill will follow that order. Use Home > Sort Ascending or Sort Descending on the relevant column first.
- Open the Advanced Editor. On the Home tab, select Advanced Editor. You will see the M code for your query.
- Find the step that produces the table you want to fill. It usually looks like
Sourceor a renamed step such asChanged Type. - Add a new step after it. On a new line inside the
letblock, write:Filled Up = Table.FillUp(PreviousStepName, {"ColumnName"})
ReplacePreviousStepNamewith the name of the step immediately before it, andColumnNamewith the exact header of your column, in double quotes. - Update the
inclause at the bottom of the query so it returns your new step, for examplein Filled Up. If you leave the old step name there, the fill will not appear in the output. - Select Done to close the Advanced Editor. The column should now show the value from the row below in every previously blank cell.
- Check the result. Scroll to the bottom of the table and confirm the last rows are filled as expected, then use Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to load the cleaned table.
Common Mistakes
- Filling the wrong direction. Table.FillUp fills upward; if your labels sit at the top of each group, use Table.FillDown instead.
- Using the wrong step name. The first argument must be the exact name of the previous step, including spaces, or the query will error.
- Forgetting the curly braces. The second argument is a list of column names in braces, for example
{"Region"}, not a bare column name. - Leaving the
inclause unchanged. The new step exists but is never returned, so nothing changes in the output. - Empty text versus null. A cell containing an empty string is not a null, so Table.FillUp skips it. Clean the column first.
- Filling across the wrong sort order. The function follows row order, so sort before you fill, not after.
Tips
- You can fill several columns in one step by listing them:
Table.FillUp(PreviousStep, {"Region", "Category"}). - If you prefer the ribbon, the Transform tab has Fill > Up and Fill > Down buttons that write the same M code for you. Use them if you are not comfortable editing the Advanced Editor.
- Keep a copy of the step before the fill so you can compare the before and after output if something looks wrong.
- Fill only the columns that need it. Filling every column can overwrite intentional blanks in numeric or date fields.
- Add a comment line above your custom step, for example
// fill region labels upward, so the query stays readable later.
Troubleshooting
If the query returns an error after you add the step, check the step name and the column name first. A misspelled column name in the braces is the most common cause. If the step runs but nothing changes, confirm the in clause points to the new step and that the blanks are true nulls rather than empty strings. If only some blanks fill, the remaining cells probably contain spaces or text; use Transform > Replace Values to clear them, then reapply the fill. If the fill appears to jump between groups, the table is not sorted the way you expect; add a Sort step before the fill. If the column type changed unexpectedly, set the type explicitly after the fill step rather than before it. When in doubt, delete the custom step, re-add it through the Transform tab's Fill > Up button, and inspect the generated code in the formula bar to see the correct syntax for your version.
Frequently Asked Questions
What does Table.FillUp do in Power Query?
It replaces null values in the listed columns with the value from the row below, working from the bottom of the table upward.
How is it different from Table.FillDown?
Table.FillDown copies values downward from the row above; Table.FillUp copies upward from the row below. Choose based on where your labels sit in each group.
Can I fill more than one column at once?
Yes. Pass a list of column names as the second argument, for example {"Region", "Category"}.
Why are my blanks not being filled?
They are probably empty text strings rather than nulls, or the in clause still points to the old step. Clean the column and check the final step name.
Does Table.FillUp work in both Excel and Power BI?
Yes, it is part of the Power Query M language used by both. The editor layout differs slightly between the two, but the function syntax is the same.
Will it overwrite existing values?
No. It only replaces nulls. Cells that already contain a value are left untouched.