PQ: Remove/Delete rows if specfic row of all columns are blank.

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
765
Hello friends, Hope all is safe & well!
Please help me with Power Query. I want to delete the entire rows: 7, 11, 13, 14 and 15; based on the conditions that all cells are empty in all existing columns.

Thank you very much in advance!

Please
picture.jpg
 
seriously thanks a lot! OK one last hiccup; please help. I wish to delete all rows based on the column before the last "ProjectAlias". If it is Null, then delete all rows.
So sorry, but this is the icing on the cake! much appreciated!

pic3.jpg
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Is this what you want? The column name before " ProjectAlias " may vary?

The "ProjectAlias" column is the 7th column:

1601307788805.png


The "ProjectAlias" is the 6th column:

1601307893043.png
 
Upvote 0
Sorry for the confusion; Basically, I want to Delete all rows if "ProjectAlias" =null.

When I used the below code, I got this message: "Expression.Error: The name 'table.ColumNames' wasn't recognized. Make sure it's spelled correctly."

VBA Code:
= let a=table.ColumNames(Source),
        b=List.PositionOf(a,"ProjectAlias")-1,
        c=List.Select(Table.ToRows(Source),each not (_{b}=null))
in
#table(a,c)
 
Last edited:
Upvote 0
Rich (BB code):
= Table.RemoveColumns(Table.SelectRows(Table.AddColumn(previous_step, "Custom", each [ProjectAlias] = null), each ([Custom] = false)),{"Custom"})
 
Last edited:
Upvote 0
Thank you very much! so Table.RemoveColumns will remove Rows that have null in ProjectAlias? is there a thing called Table.RemoveRows ?
Thanks a lot!
 
Upvote 0
if you add this line to the end of your code in Advanced Editor with step name, eg. Filter you will see how it works
Filter = Table.RemoveColumns(Table.SelectRows(Table.AddColumn(previous_step, "Custom", each [ProjectAlias] = null), each ([Custom] = false)),{"Custom"})
example
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    Filter = Table.RemoveColumns(Table.SelectRows(Table.AddColumn(Source, "Custom", each [ProjectAlias]=null), each ([Custom] = false)),{"Custom"})
//in Filter line  Source is a name of previous step
in
    Filter
in short
Table.RemoveColumns will remove column you just created to remove nulls in ProjectAlias column

post your code from Advanced Editor here, use code tags [code]your code here[/code]

or just filter ProjectAlias column by null
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,766
Messages
6,174,372
Members
452,560
Latest member
Turbos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top