Forum Discussion
Nested IF Statement with logical or condition
- 5 years ago
Note that the logical statement "a <> 1 || a <>2" is always true since if a <> 1 then the first case hold and, otherwise, if a = 1, then a <> 2 and the second case holds. This is why you never get to the "TBD" condition.
The negation of "a = 1 || a = 2" is not "a <> 1 || a <> 2" but rather "NOT ( a =1 || a = 2 )" = "a <> 1 && a <> 2".
I'd recommend rewriting your logic more compactly like this:
FTC_Fail_Pass = IF ( ISBLANK ( Booking[brs_followupreason (groups)] ), "TBD", IF ( Booking[brs_followupreason (groups)] IN { "Customers did not show up for meet", "Branch staff turned me away", "Site not ready", "Vendor did not show up for meet" }, "Fail", "Pass" ) )
Note that the logical statement "a <> 1 || a <>2" is always true since if a <> 1 then the first case hold and, otherwise, if a = 1, then a <> 2 and the second case holds. This is why you never get to the "TBD" condition.
The negation of "a = 1 || a = 2" is not "a <> 1 || a <> 2" but rather "NOT ( a =1 || a = 2 )" = "a <> 1 && a <> 2".
I'd recommend rewriting your logic more compactly like this:
FTC_Fail_Pass =
IF (
ISBLANK ( Booking[brs_followupreason (groups)] ),
"TBD",
IF (
Booking[brs_followupreason (groups)]
IN {
"Customers did not show up for meet",
"Branch staff turned me away",
"Site not ready",
"Vendor did not show up for meet"
},
"Fail",
"Pass"
)
)