Filling Missing Values with the Previous Available Value in Power Query

0 votes

Filling Missing Values with the Previous Available Value in Power Query
You have a dataset where missing values are represented as nulls. You need to fill the missing values with the last available value in the column. What is the best approach in Power Query to achieve this efficiently?

16 hours ago in Power BI by Evanjalin
• 17,020 points
18 views

1 answer to this question.

0 votes

This guide for filling missing values with the last available value in Power Query explains as follows:

1. Open Power Query Editor.

Select the dataset that contains null values.

Identify the column where missing values (nulls) are to be filled.

2. Sort the Data (if needed)

If the fill criterion requires the data to be in a certain order, first sort by Date, ID, or any other relevant field to be logically ordered.

3. Fill Down (best in more direct cases)

Select the column containing nulls.

Select the Transform Tab → Fill Down.

This will replace each null with the non-null value above it.

4. Using M Code for Advanced Control

If you need more flexibility or want to automate the process, use M code:

= Table.FillDown(Source, {"ColumnName"})
  • Replace "ColumnName" with the actual column name.
  • This efficiently fills nulls with the last known value.

5. Handling Edge Cases

  • Leading Nulls (first row is null): These will remain null unless explicitly replaced
= Table.ReplaceValue(FilledDown, null, "DefaultValue", Replacer.ReplaceValue, {"ColumnName"})
  • Multiple Columns: Use Table.FillDown(Source, {"Col1", "Col2"}) to apply fill-down on multiple columns simultaneously.
answered 16 hours ago by anonymous
• 17,020 points

Related Questions In Power BI

0 votes
1 answer

How can I get a column value from previous row in Power Query?

Hi Sindhu, add this line as your ...READ MORE

answered Mar 18, 2019 in Power BI by Cherukuri
• 33,030 points
8,500 views
0 votes
0 answers

After connecting SharePoint List with Power BI, and editing data in query, all the data I want are in links

I've try so many ways to decode ...READ MORE

Jun 18, 2020 in Power BI by Dora
• 120 points
1,271 views
+1 vote
1 answer

Have column with multiple values in powerBI, for use with a slicer in power bi

It can be achieved depending on the result you ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
7,637 views
0 votes
1 answer

Calculated column with the sum of values from many columns in a row

Hi, You can create a new column by ...READ MORE

answered Mar 14, 2019 in Power BI by Cherukuri
• 33,030 points
2,791 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,507 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,130 points
2,858 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 18,520 points
1,640 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Open power bi report nd sign in ...READ MORE

answered Oct 10, 2023 in Power BI by Monika kale

edited 5 hours ago 1,778 views
0 votes
1 answer

What are the available methods to create a Sunburst visualization in Power BI?

Power BI does not have a native ...READ MORE

answered 5 days ago in Power BI by anonymous
• 17,020 points
34 views
0 votes
1 answer

What is the best approach to convert a Date/Time column to a Date data type in Power Query while using DirectQuery from SQL?

For DirectQuery, the best way to convert ...READ MORE

answered 5 days ago in Power BI by anonymous
• 17,020 points
35 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP