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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JemmaD
Resolver II
Resolver II

M Query remove blank rows across all columns

I have a table with four columns, some of the rows are entirely blank but I want to remove only those rows where every column is null. How do I do this? 

1 ACCEPTED SOLUTION
DOLEARY85
Super User
Super User

Hi,

 

you can just use the remove blank rows option.

 

DOLEARY85_0-1681907453987.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

3 REPLIES 3
DOLEARY85
Super User
Super User

Hi,

 

you can just use the remove blank rows option.

 

DOLEARY85_0-1681907453987.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Adamboer
Responsive Resident
Responsive Resident

 

To remove only the rows where every column is null, you can use the following SQL query:
DELETE FROM your_table
WHERE column1 IS NULL
AND column2 IS NULL
AND column3 IS NULL
AND column4 IS NULL

This query will delete all rows where every column is null. If a row has at least one non-null value in any of the columns, it will not be deleted.

Alternatively, if you want to keep the original table intact and just display the rows with non-null values, you can use the following SQL query:

SELECT * FROM your_table
WHERE NOT (column1 IS NULL
AND column2 IS NULL
AND column3 IS NULL
AND column4 IS NULL)

This query will select all rows where at least one column has a non-null value. The NOT operator negates the condition that every column is null, so only rows that satisfy this condition will be displayed.





@Adamboer How do I use SQL in Power Query Editor? It uses M Query Language...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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