Select rows if …

adambc

Active Member
Joined
Jan 13, 2020
Messages
373
Office Version
  1. 2019
  2. 2016
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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,215,126
Messages
6,123,198
Members
449,090
Latest member
bes000

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