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!
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
Proud to be a Datanaut!