Select rows if …

adambc

Active Member
Joined
Jan 13, 2020
Messages
412
Office Version
  1. 365
Platform
  1. Windows
I’ve got a PQ that’s working perfectly until the last step!

I have 3 columns I want to filter in as follows …

In main PQ, select rows if ALL 3 columns contain a value ie NONE of the columns are null …

In a duplicate of the main PQ, select rows if ANY column is null ie 1 or many of the columns ARE null

Can anyone help me with the M code?

Thanks …
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
col1col2col3
ab
dfe
457
9
xyz

Power Query:
let
    Source = Table.ToRows(sample),
    NotNull = List.Select(Source, each List.NonNullCount(_)=3),
    RestoreTable = Table.FromColumns(NotNull)
in
    RestoreTable
let
Source = Table.ToRows(sample),
NotNull = List.Select(Source, each List.NonNullCount(_)<3),
RestoreTable = Table.FromColumns(NotNull)
in
RestoreTable
Power Query:
 
Upvote 0
col1col2col3
ab
dfe
457
9
xyz

Power Query:
let
    Source = Table.ToRows(sample),
    NotNull = List.Select(Source, each List.NonNullCount(_)=3),
    RestoreTable = Table.FromColumns(NotNull)
in
    RestoreTable
let
Source = Table.ToRows(sample),
NotNull = List.Select(Source, each List.NonNullCount(_)<3),
RestoreTable = Table.FromColumns(NotNull)
in
RestoreTable
Power Query:
@ GraH

Not sure what this is doing, or how to use it with my table?

Have I confused by saying “I have 3 columns I want to filter”?

I have other columns too - and my 3 columns are not all adjacent (2 are, but the 3rd isn’t).
 
Upvote 0
@adambc , maybe you can enlighten us by providing a sample of your data, be it preferably anonimized.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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