Hi all,
I am new to Alteryx, so I am guessing this is something simple; but i cannot figure it out. (I have tried several variations of iif and if-then, with parenthesis everywhere). When I run these two statements independently, they each work, but when I try to run them together with an OR, everything comes back as "No". Can someone give me some guidance?
Statement 1 - iif (!Contains([Position], 'Center'), 'No', 'Yes')
Statement 2 - iif (!Contains([Position], 'Operation'), 'No', 'Yes')
Combined Statement - iif (!Contains([Position], 'Center') || !Contains([Position], 'Operation'),'No', 'Yes')
Thank you in Advance!
Solved! Go to Solution.
The way the logic works here is that if either is true, then the condition is true. Try reversing your conditions like this:
IIF(Contains([Position], 'Center') || Contains([Position], 'Operation'),'Yes', 'No')
Hi @RTD
Combining logical negations is always tricky. The formula you have only works if your input contains both Operation and Center. Anything else causes one of the or clauses to be true so the entire statement is true returning 'No'
Is this the result you want? If you actually want it to return yes, if it contains 'Operation' or if it contains 'Center' follow @CharlieS.
Dan
It gets a little tricky because this is only part of a larger formula that I have; where if a few other conditions aren't met either it will default to "Yes". So ideally I could use a logic like this to exclude instead of include. Does that makes sense? But I am open to any suggestions; i am just starting to learn. Thank you
Oh, that is very helpful. Thank you! I am not sure how to get around this, as this is part of a larger formula where ultimately the default condition is "Yes". So I want to the result to be "Yes" if it contains either Center or Operation or if it contained Center&Operation.
If you continue using exclusionary logic, change the "||" to "&&" meaning if it's not Operation AND it's not Center return 'No' else return 'Yes'
Dan
Since we're replying almost real time the post are showing up out of order. Check out my post 2 above this one about changing the '||' to '&&'
Dan
That makes sense, I had my mind on "doesn't have this OR that OR that".
Thank you!
Thank you! That makes sense to me. I switched over to &&.