Forum Discussion
Removing a Row based on all rows being blank except in the first column.
I query from a file folder that includes multiple files (for this example those files are TEST3 & TEST4 shown in Column A) and all those files have the same type information with the same column headers. The only problem I have is when I run a query it pulls all the blank rows. I tried removing blank rows, but since my Column A is not blank it will not remove them. Is there a code I can place in the Advanced Editor on the Query Editor to remove rows that are completely blank even when Column A shows up with the title of the file?
3 Replies
- jthomson
Solution Sage
You can do this in query editor - I'd make sure that all of the blank data is formatting as nulls, then make a custom column that's something like
columntogetridoftheblanks = if column1 = null and column2 = null and ...(repeat for all your columns) then "delete" else null
You can then filter out anything that says delete in the new column. Probably a more efficient way to do this though
- calhouncoNew Member
Sounds like something that would work. I just do not know much about the certain code that would be required for this action. Any help would be good. Thank you.
- mouse_artRegular Visitor
This is an old post, but still worth recording the best solution I've seen so far:
#"Removed Blank Rows" = Table.SelectRows(#"Previous step", each not List.IsEmpty(List.RemoveMatchingItems(List.Range(Record.FieldValues(_),1,Table.ColumnCount(#"Previous step")-1), {"", null})))The advantage is that you don't need to know how many columns you have.