Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
In Power Query, is there a way to dynamically filter (or merge) a primary table based on a column name (and values) found in another table (or list)?
Hopefully this visual helps understand my question:
Main Table (to filter):
| RowNumber | Tier1 | Tier2 | Details |
| 1 | Tier1Val1 | Tier2val1 | blah blah 1 |
| 2 | Tier1Val2 | Tier2val2 | blah blah 2 |
Filter Table (where I define which column to filter or merge on, and the value to match):
| FilterColumn | FilterValue |
| Tier2 | Tier2val2 |
Can this be done (without pivoting or unpivoting the first column)?
Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous
You could use Record.Field within Table.SelectRows, copy this script into a new blank query.
Note that "Filters" is included in this query but you can just as easily place that in a separate query as long as you give that new query the same name OR update the name in the expression below.
let
Filters = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslMLTJS0oHQZYk5RkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FilterColumn = _t, FilterValue = _t]),
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQrJTC0yDEvMgbGNyiDspJzEDAUwYagUqxOtZISk1ghJrRGKWiOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [RowNumber = _t, Tier1 = _t, Tier2 = _t, Details = _t]),
SelectRows = Table.SelectRows( Source, each Record.Field( _, Filters{0}[FilterColumn] ) = Filters{0}[FilterValue] )
in
SelectRows
Here's the result
Ps. If this helps solve your query please mark this post as Solution, thanks!
Hi @Anonymous ,
I'd buffer your filter table column as a list and pass it into a Table.SelectRows, like this:
Table.SelectRows(
previousStepName,
each List.Contains(List.Buffer(FilterTable[FilterValue]), [Tier2])
)
The advantage with this over @m_dekorte 's answer, and others, is that this method will fold to the source, even if the second (filter) table isn't on the server.
Power query will buffer the filter table column then stream it to the foldable source in the WHERE clause of the native query, making it clean, tidy, and fast.
Pete
Proud to be a Datanaut!
Hi @Anonymous ,
I'd buffer your filter table column as a list and pass it into a Table.SelectRows, like this:
Table.SelectRows(
previousStepName,
each List.Contains(List.Buffer(FilterTable[FilterValue]), [Tier2])
)
The advantage with this over @m_dekorte 's answer, and others, is that this method will fold to the source, even if the second (filter) table isn't on the server.
Power query will buffer the filter table column then stream it to the foldable source in the WHERE clause of the native query, making it clean, tidy, and fast.
Pete
Proud to be a Datanaut!
Hi @Anonymous
You could use Record.Field within Table.SelectRows, copy this script into a new blank query.
Note that "Filters" is included in this query but you can just as easily place that in a separate query as long as you give that new query the same name OR update the name in the expression below.
let
Filters = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslMLTJS0oHQZYk5RkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FilterColumn = _t, FilterValue = _t]),
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQrJTC0yDEvMgbGNyiDspJzEDAUwYagUqxOtZISk1ghJrRGKWiOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [RowNumber = _t, Tier1 = _t, Tier2 = _t, Details = _t]),
SelectRows = Table.SelectRows( Source, each Record.Field( _, Filters{0}[FilterColumn] ) = Filters{0}[FilterValue] )
in
SelectRows
Here's the result
Ps. If this helps solve your query please mark this post as Solution, thanks!
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |