Use of Parentheses

January 13, 2024

Parentheses can be used to control the order of operations and form complex conditions. Consider the rule:

over the last 30 days (acos > 20% AND clicks > 1000 OR sales < $500).

By default, due to the precedence of operators, the AND operation would be performed first, implying that within the last 30 days, the acos should be greater than 20%, and the clicks should be over 1000. If this is true, or if the sales are less than $500, the entire rule is satisfied.

However, if you want the rule to check if acos is more than 20%, and at the same time either clicks are over 1000 or sales are under $500, you would use parentheses to express this. The rule would be written as:

over the last 30 days (acos > 20% AND (clicks > 1000 OR sales < $500)).
Need more help?