Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Deleting/filtering every row with null values in every column

Hello community,

I have merged 40 tables. Every table has between 100-500 rows  null values across the entire entire row, where there might only be between 5-100 rows with data in them.

I wish to delete all the rows that have null values across all columns after the last row with data in it. How can that be done?

 

My first thought was to replace all nulls and 0's with blanks and then remove use the remove blank rows in a function for all the tables.

 

The issue here is that not all the tables have the exact same amount columns

 

    #"Replaced Value" = Table.ReplaceValue(#"Medie booking - 2022H1_Sheet",null,"",Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20", "Column21", "Column22", "Column23", "Column24", "Column25", "Column26", "Column27", "Column28"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",0,"",Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20", "Column21", "Column22", "Column23", "Column24", "Column25", "Column26", "Column27", "Column28"}),
    #"Removed Blank Rows" = Table.SelectRows(#"Replaced Value1", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
in
    #"Removed Blank Rows"
    1. Select all the columns you want Anonymous to test for null on.
    2. In the Add Column ribbon, select Merge Columns with no special delimiter.
    3. Filter that newly Merged column for null, or select the "remove empty" filter. Remove Empty will remove blanks and nulls.
    4. Delete the temporary merged column.

     

2 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion
    1. Select all the columns you want Anonymous to test for null on.
    2. In the Add Column ribbon, select Merge Columns with no special delimiter.
    3. Filter that newly Merged column for null, or select the "remove empty" filter. Remove Empty will remove blanks and nulls.
    4. Delete the temporary merged column.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, I edited the text as I discovered that I do not have the exact same amount of columns. Could you take a look at it again?