Free Trial

Alteryx Designer Desktop Discussions

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

Formula tool IF statement-multiple conditiions

hbland2
6 - Meteoroid

I am getting error on the below formula. Please help.

 

IF[Age]>=180,IF([Age],365,IF(ABS([Amount in local cur.])<250000,[Amount in local cur.],0),0),)

 

Thanks!

12 REPLIES 12
vizAlter
12 - Quasar

Hi @hbland2 — The way you have written IF...ELSE... ENDIF is not Alteryx's style.

Try to write like below:

IF condition1 THEN 
 true1 
ELSEIF condition2 THEN 
 true2 
ELSEIF condition3 THEN 
 true3 
ELSE 
 false 
ENDIF

or let us know if you need more help.

hbland2
6 - Meteoroid

Need more help please @vizAlter 

ImadZidan
12 - Quasar

Hello @hbland2 ,

 

not sure what the logic is but if you want to use IIF then this may help. the below is syntactically correct but the logic needs checking.

 

IIF([Age]>=180,IIF([Age]=365,IIF(ABS([Amount in local cur.])<250000,[Amount in local cur.],0),0),0)

 

This logic is as follows

 

If age >=180, then another check on the age

IF age = 360 Then another check on the amount

If amount <250000 then amount else 0

 

hbland2
6 - Meteoroid

This formula says if the age is greater than 180 days and the value is less than $250k then return the value in Amount in local Currency. If the age is less than 180 days or greater than 365 days, then return 0

vizAlter
12 - Quasar

@hbland2 — Either use IF... ELSEIF... ELSE... END statements, or use IIF( ) statements.

vizAlter
12 - Quasar

@hbland2 — Hope this helps:

 

IF [Age]>180 AND [Amount in local cur.] < 250000 THEN 
 [Amount in local cur.]
ELSEIF [Age]>365 OR  [Age]<180  THEN 
 0 
ELSE 
 Null() 
ENDIF

 

vizAlter_0-1600889483852.png

 

Or write 0 instead of Null(), like below:

IF [Age]>180 AND [Amount in local cur.] < 250000 THEN 
 [Amount in local cur.]
ELSEIF [Age]>365 OR  [Age]<180  THEN 
 0 
ELSE 
 0 
ENDIF

vizAlter_0-1600889683058.png

 

ImadZidan
12 - Quasar

Hello @hbland2 ,

 

you can this as a logic.

 

IIF ([Age]>180 and [Age] <=365 and ABS([Amount in local cur.])<250000, [Amount in local cur.],0)

 

Hope it helps

hbland2
6 - Meteoroid

Hi @ImadZidan, thanks for the assistance.

That logic looks right, but I am getting below error..

hbland2_0-1600891118943.pnghbland2_1-1600891139916.png

 

hbland2
6 - Meteoroid

Hi @vizAlter thanks for assistance. I am still getting error below.

Any ideas? Thanks!

 

hbland2_1-1600891717634.pnghbland2_2-1600891739077.png

 

Labels
Top Solution Authors