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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to group Table.SelectRows criteria?

Hello

 

Can you tell me please the right syntax for the below?

 

#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Metric], "something1") and not Text.Contains([Metric], "something2") or [Metric] >0)

 

Particularly, how can I group into parentheses?

Is it:

each not ([1]>0 and [1]>2) and not (...

or

each not ([1]>0 and not [1]>2) and not (...

or

each (not [1]>0 and not[1]>2) and (not ...

 

In summary, do we group the 'not' inside parentheses or outside? When do we repeat it? When do we 'cancel' it, i.e. when we start with a 'not' criteria and then want to include positive/'without not' criteria?

 

Thanks!

1 REPLY 1
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

The parentheses control how you want conditions to be evaluated in relation to one another, so there is no 'right' placement, it depends entirely on what you are trying to achieve.

 

For example:

( [A] = 1 and [B] = 2 ) or [C] = 3

This reads as [A] AND [B] must BOTH meet their conditions OR [C] must meet its condition to give the required output

 

[A] = 1 and ( [B] = 2 or [C] = 3 )

This reads as [A] must meet its condition AND either [B] OR [C] must ALSO meet their condition to give the required output

 

Therefore there's no way of saying whether the syntax example you provided is 'right', as we don't know what your expected/desired result from this filter is.

 

Regarding the 'not' operator - this reverses the evaluation of the function immediately following it, therefore should be included within any parentheses that encapsulate the relevant function.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors