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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
UsePowerBI
Post Prodigy
Post Prodigy

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 @UsePowerBI ,

 

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors