- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Filter table in Power Query based on two columns
Hello guys,
trying to figure out what I though is an easy task so I can streamline my queries.
I have two colums I want to use to filter
Column 1: File name:
- 2021 Consolidation.xlsm
- 2021 Unconsolidated.xlsm
Column 2: Financial Statement item:
- Sales
- Sales Intercompany
- Cost
- Cost Intercompany
What I want to do is to remove the lines matching following criteria:
- Column 1 text contains "unconsolidated"
AND
- Column 2 contains "Sales Intercompany" or "Cost Intercompany"
I already have a solution to achieve that filtering, via a merch, but that seems too excessive for my goals.
D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I'm a bit late to the party, but I have a different take - it requires a new column but depending on how big your model is, it might be OK.
Create a concatenation of column 1 and 2.
This creates strings like:
unconsolidated Sales Intercompany
unconsolidated Cost Intercompany
In the new column, you can filter for those strings, using the usual Power Query column filter function (no actual coding required).
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hey @danielboi ,
create a custom column using an if statement in combination with the function Text.Contains (https://docs.microsoft.com/en-us/powerquery-m/text-contains) like so
if
Text.Contains( [Column1] , "A")
and
(
Text.Contains( [Column2] , "yellow") or Text.Contains( [Column2] , "red")
)
then "omit" else "keep"
Be aware of the brackets.
Then you can use to values to filter the table and remove the column after the filtering.
Hopefully, this provides an idea on how to tackle your challenge.
Regards,
Tom
Did I answer your question? Mark my post as a solution, this will help others!
Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hey @danielboi ,
if you are familiar with M and the Advanced Editor you can use this one:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUSpKTVGK1YGwK1NzcvLL4dz0otTUPKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"onego" =
Table.SelectRows (
#"Changed Type" , (_) =>
( Text.Contains( [Column1] , "A") and
( Text.Contains( [Column2] , "yellow") or Text.Contains( [Column2] , "red") ) = false
)
)
// #"Added Custom" = Table.AddColumn(#"Changed Type", "condition", each if Text.Contains( [Column1] , "A") and
// ( Text.Contains( [Column2] , "yellow") or Text.Contains( [Column2] , "red")
// ) then "omit" else "keep")
in
#"onego"
Regards,
Tom
Did I answer your question? Mark my post as a solution, this will help others!
Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
06-06-2024 07:56 AM | |||
11-08-2023 11:58 AM | |||
03-07-2024 04:38 AM | |||
06-12-2024 01:02 AM | |||
02-19-2024 07:13 AM |
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |