Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
rsbin
Super User
Super User

Text Does Not Contain

Good Afternoon,

Haven't had to use Power Query in a while, but don't understand why I am unable to filter my column [Facility] correctly.

I want to include only those rows where the text "TSI" or "HUB" does not appear anywhere in the value.

Alternatively stated, exclude all rows where either of these two text strings exist.

Below is the last line of the Advanced Editor.

 

#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each not Text.Contains([Facility], "TSI") or not Text.Contains([Facility], "HUB")
in
#"Filtered Rows"

 

Am I not using this function correctly?

All help is much appreciated!

Thanks and kind regards,

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

bracked missing after each. Since you are using one and condition, hence brackets are needed.

Use this

= Table.SelectRows(#"Renamed Columns", each (not Text.Contains([Facility],"HUB") and not Text.Contains([Facility],"TSI")))

Alternatively, you can use an OR condition with not outside'

= Table.SelectRows(#"Renamed Columns", each not (Text.Contains([Facility],"HUB") or  Text.Contains([Facility],"TSI")))

View solution in original post

3 REPLIES 3
WillJ731
New Member

A potentially easier way to exclude values from a row would be to use the M 'does not equal' operator ('<>'). I'd suggest something like this:

#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Facility] <> "TSI" and [Facility] <> "HUB"
in
#"Filtered Rows"

 

Vijay_A_Verma
Super User
Super User

bracked missing after each. Since you are using one and condition, hence brackets are needed.

Use this

= Table.SelectRows(#"Renamed Columns", each (not Text.Contains([Facility],"HUB") and not Text.Contains([Facility],"TSI")))

Alternatively, you can use an OR condition with not outside'

= Table.SelectRows(#"Renamed Columns", each not (Text.Contains([Facility],"HUB") or  Text.Contains([Facility],"TSI")))

@Vijay_A_Verma ,

Thanks much for the Solution.

Best Regards,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.