When you have blank values in your data table, you can use Power Query transformations to remove the row with blank values. There are two transformations that are used very often for this purpose: Remove Empty and Remove blank rows. These two transformations are not exactly the same. In this article, I’ll explain what is their differences.
Let’s assume that we have a table with the sample data below;
There are two rows in the data table above that include blank values. the very first and the very last row of the table.
Power Query Editor
To remove the rows with blank values, you can click on the Transform Data and get the Power Query Editor window opened.
Remove Empty is a transformation that you can choose by clicking on the drop down on the column header;
This option, removes the entire row if the value of that row in the selected column is blank. This means values in other columns is not considered at all, they might have a value or they might be blank.
In the example above, the last rows, which was entirely blank, and also the first row, which was not blank in the Column1, but it was blank in the Column2 (which was the column we used the Remove Empty on it), both removed.
Remove Blank Rows
If you want to remove the row only if all values (across all columns) are empty, then Remove Blank Rows is a better option. You can find it under Remove Rows.
This option, will check the value in every single cell of that row, and will remove the row if all of those values are blank. For this operation, it doesn’t matter what column you have selected, the output will be like this:
As you realized, for some of the transformations in Power Query, the selected column is important. We can call them column-dependent transformations. Some of the examples of these transformations are;
- Remove Empty
- Replace Error
- Replace Value
There are also some transformations, which for them, the selected column doesn’t matter. Or we can call them Column-independent transformations. Here are some of those transformations;
- Remove Blank Rows
- Remove Top/Bottom/Alternate Rows
- Keep Top/Bottom/Range of Rows
And there are some transformations that depend on the context, can apply to a column or the whole table. Such as below list;
There is no right or wrong transformation in the lists above. Each of the transformations above can be useful in a specific scenario. You need to choose the right transformation for the given requirement.