Forum

Filtering a table w...
 
Notifications
Clear all

Filtering a table with List.Contains

2 Posts
2 Users
0 Reactions
227 Views
(@the-fred)
Posts: 3
Active Member
Topic starter
 

Hello

I am very new to Power Query so please bear with me. Can someone help with a basic question?

I have used the Power Query editor to filter a column. It shows:

#"Filter CLASS"= Table.SelectRows(#"Uppercase CLASS", each ([#"CLASS"] = "Chemistry" or [#"CLASS"] = "Physics")

I would like to simplify this code as the actual filter expression will have many identifiers. I have tried the following (plus many variations) but they have not worked:

#"Filter CLASS"= Table.SelectRows(#"Uppercase CLASS", each List.Contains({"Chemistry","Physics"},[#"CLASS"]))

What is the correct syntax?

Thanks

 
Posted : 07/06/2018 8:29 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Fred,

No need to simplify it. Just use the Filter drop down on the column to set your filters and let Power Query worry about the M code.

Mynda

 
Posted : 08/06/2018 6:43 pm
Share: