Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
calhounco
New Member

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?

Example.PNG

3 REPLIES 3
mouse_art
Regular 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.

jthomson
Solution Sage
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

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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.