Table.SelectRows - Mutliple filters - Does it matter if I use 'and' or 'or?

Hi
This is a small point but I’d like to understand if there is a different between ‘and’ and ‘or’ when including or excluding items for a given column.

Here’s the code

In this code, I want to select only those with a Status of Done or Awaiting Acceptance. Ignore the rest of the query.

So should it be ‘and’ or 'or?

Table.SelectRows(Keep, each ([Status] = “Done” or [Status] =“Awaiting Acceptance” ) and (not Text.Contains ([Issue Type],“ask”) and ([Keep] =“Keep”)))

Not urgent by any means. But I know many of you will know if it matters.

Thanks Erica

Hi Erica / @Ericadyson ,

Yes, there is a difference

AND - means that both conditions need to be met
OR - means that one of the condition need to be meet

Usually if you have one attribute like Status you use OR to get Status is either in Done or Awaiting Accceptance

if you put AND - if you don’t for the same record Done and Awaiting Accceptance you do not get any record.

If you have more then 2 conditions and mix AND and OR I advice to put brackets () to make more clear view.

More of Boolean operators you can find at:

If you need more clarification please let us know.

Best regards

1 Like

Thanks a lot - so is this correct?

Status - exclude those statuses
Issue Type - exclude any status that has the string ‘ask’ ie Task, task, sub-task, sub task
Status - exclude the string with ‘est’ ie Test, test

= Table.SelectRows(Keep, each ([Status] <> “Cannot Reproduce” or [Status] <> “Not A Bug” or [Status]<> “Duplicate” or [Status]<>“Work As Designed” or [Status]<>“Work As Designed” or [Status]<>“Cancelled”) and (not Text.Contains([Issue Type],“ask”)) and (not Text.Contains ([Issue Type],“est”)))

when you have Status] <> it should be AND
[Status] <> “Cannot Reproduce” AND [Status] <> “Not A Bug” ,…

(at the same time different from “Cannot Reproduce” and “Not A Bug” etc.)

Yes. That’s what I had in the first place. It seems to be this:

If it’s an include filter = OR
If it’s an exclude filter = AND

Then my queries work and I feel confident that all the filters work correctly.

Many thanks