Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Multi-row IF AND statement

mtqromain
6 - Meteoroid

Good morning,

 

I am trying to create a formula over multiple rows, and I keep receiving 2 message errors saying "Invalid type in operator ==."

My alteryx attempt is the following formula:

 

IF
([Collaboration?] == "TRUE" AND [Row+1:Collaboration?] == "FALSE") OR

([Collaboration?] == "TRUE" AND [Consecutive similar PN?] == "False" AND [Row+1:Collaboration?] == "TRUE")
then "Yes"
else ""
endif

 

Any idea where the problem might come from?

For reference, the excel formula worked as follows:

 

=IF(OR(
AND([@[Collaboration ?]]=TRUE;O3=FALSE);
AND([@[Collaboration ?]]=TRUE;O3=TRUE;[@[Consecutive similar PN?]]=FALSE);
"Yes";"")

 

Thanks a lot for your help!

4 REPLIES 4
ShankerV
17 - Castor

Hi @mtqromain 

 

You need to use only 1 = instead of 2 in the below formula.

 

Try the below.

IF
([Collaboration?] = "TRUE" AND [Row+1:Collaboration?] = "FALSE") OR

([Collaboration?] = "TRUE" AND [Consecutive similar PN?] = "False" AND [Row+1:Collaboration?] = "TRUE")
then "Yes"
else ""
endif

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @mtqromain 

 

Please find the expected output.

 

ShankerV_0-1672643167192.png

ShankerV_0-1672643204393.png

Note: The workflow used to achieve the solution is attached which can be downloaded to see how the solution works.

 

If you believe your problem has been resolved. Please mark helpful answers as a solution so that future users with the same problem can find them more easily!!!!

 

Many thanks

Shanker V

 

mtqromain
6 - Meteoroid

thanks a lot! it works great :)

ShankerV
17 - Castor

@mtqromain 

 

The below formula didn't work because Alteryx read the column ([Collaboration?] as Boolean 1 and 0.

 

IF
([Collaboration?] = "TRUE" AND [Row+1:Collaboration?] = "FALSE") OR

([Collaboration?] = "TRUE" AND [Consecutive similar PN?] = "False" AND [Row+1:Collaboration?] = "TRUE")
then "Yes"
else ""
endif

 

Hence I tweaked the formula to treat Boolean 

IF ([Collaboration?] = 1 AND [Row+1:Collaboration?] = 0) OR
([Collaboration?] = 1 AND [Consecutive similar PN?] = 0 AND [Row+1:Collaboration?] = 1)
then "Yes"
else ""
endif

 

Got the result.

 

ShankerV_1-1672643416919.png

 

 

Please mark helpful answers as a solution so that future users with the same problem can find them more easily!!!!

 

Many thanks

Shanker V

 

 

Labels