Using AND and OR's in CASE WHEN statement
We are setting up a calculated field that includes a CASE WHEN statement.
Our first idea was the formula as seen in screenshot 1.
We are testing for values of 0 or NULL and in the end divide the difference by the first value.
This formula validates, but gives an error during execution. The error as shown is attached as screenshot 2.
We have spread the logic of the first when statement over 4 smaller when statements and this option does work.
We also tried various alternatives with less parentheses, but they all failed. And the alternative without any parentheses does work, but doesnt give the correct outcome, because the AND has precedence over the OR.
Why is option 1 with parentheses not working?