Alteryx Designer Desktop Discussions

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

Reading IIF formula

SH_94
11 - Bolide

Dear community, 

 

May i know how can i interepret the formula below ?

 

IIF([HOUSEHOLD]="Y", [PACKAGE]= "100" or [PACKAGE] = "200", "NonHH")

 

normally i have the result of -1 and NonHH

 

and also formula below

 

IIF([PACKAGE]="100" or [PACKAGE] = "200", [REDEMPTION]>"2020-07-05 23:59:59" and [REDEMPTION] < "2022-10-01 00:00:00", "NonDevice")

 

I was trying to interpret this written and appreciate if someone can enlighten me on this.

 

Thank you,

4 REPLIES 4
ArtApa
Alteryx
Alteryx

Hi @SH_94 - Here is how it works:

ArtApa_0-1657166259355.png

 

In your scenario you put "OR" statement instead of X. That is why you get TRUE value instead of a meaningful result.

grazitti_sapna
17 - Castor

Hello @SH_94, is it possible for you to provide the sample input and output that you are looking for?

 

Thanks!

Sapna Gupta
binuacs
20 - Arcturus

@SH_94  below is my interpretation

 

IIF([HOUSEHOLD]="Y", [PACKAGE]= "100" or [PACKAGE] = "200", "NonHH")

 

first it checks whether the HOUSEHOLD = 'Y'  and If this is true then checks for PACKAGE in (100, 200), since the second condition returns only True or False that's why you are getting -1 or 0 else NonHH

 

Note: the statement [PACKAGE]= "100" or [PACKAGE] = "200" used as the True result of the first condition [HOUSEHOLD]="Y" as well as checking whether PACKAGE is in 100 or 200 which always returns True or False. 

 

the same applies for the second formula

 

 

FilipR
11 - Bolide

Both formulas you pasted are malformed IIF statements. You can't have "OR" / "AND" in the result part. You can only use them in the condition part (before the first comma).

 

 

IIF( [boolean condition], [result if TRUE], [result if FALSE] )

 

 

Labels