PQ Filtering Tables within a column of Tables

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I have a table with a column of text values and a column of tables,

Value I Want to Exclude
Column of Tables
one
Table
two
Table
three
Table

<tbody>
</tbody>

For the "Column of Tables," those tables will contain a column with values corresponding to the "Value I want to exclude" column - and I want to filter those tables to remove the row that matches the Value I Want to Exclude. So for line one, the Table in Column of Tables may look like

Value to Match
Col1
Col2
Col3
five
xx
xx
xx
one
xx
xx
xx
seven
xx
xx
xx

<tbody>
</tbody>

For this table, I'd like to SelectRows and remove "one" since it is the value matching on that row of overall table. I tried adding a custom column like this

Table.SelectRows([Column of Tables], each [Value to Match] <> [Value I Want to Exclude]

but I get an error because the [Value I Want to Exclude] column is not part of the [Column of Tables] table, and I can't figure out how to access fields from the overall table in the SelectRows formula.

The other idea I had was to use an anti join but I don't want it to be applied against the whole table, just on a row by row basis.
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You were quite close with adding the column. The entire line of your code probably looks like this:

Code:
StepName = Table.AddColumn(PreviousStep,"NewColumn", each Table.SelectRows([Column of Tables], each [Value to Match] <> [Value I Want to Exclude]))

You can change this to something like:

Code:
StepName = Table.AddColumn(PreviousStep,"NewColumn", ([B]MainTable) => [/B]Table.SelectRows([Column of Tables], each [Value to Match] <> [B]MainTable[/B][Value I Want to Exclude]))
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,402
Members
449,156
Latest member
LSchleppi

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