Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

IF formula issue

MMG
5 - Atom

I am trying to input the formula from excel:

=IF(OR([@[Ending Balance Trx CCY]]=0,[Trx CCY]="USD"),1,[@[Ending Balance Func CCY]]/[@[Ending Balance Trx CCY]])

 

Into my alteryx work flow the only was i can think of doing it is as follows:

IF [Ending Balance Trx CCY]='0' THEN '1' ELSEIF [Ending Balance Trx CCY]>'0' Then ([Ending Balance Func CCY]/[Ending Balance Trx CCY]) ELSEIF [Ending Balance Trx CCY]<'0' THEN ([Ending Balance Func CCY]/[Ending Balance Trx CCY]) ENDIF

 

however this brings back a Malformed if Statement error. I am unsure where i went wrong? the data is double on all fields so its not a string type issue?

 

Thanks in advance

4 REPLIES 4
CarlDi
Alteryx
Alteryx

Hi @MMG - try removing the single quotes around the numbers of your alteryx statement. As you said, your types are double and placing quotes around them convert them to strings. hope that helps!

Martyn
9 - Comet

@MMG 

 

I think the main issue is there is no ELSE in your logic.

 

IF .....

THEN.....

ELSEIF.....

THEN.....

ELSEIF.....

THEN....

ELSE.....

ENDIF

 

LukeG
Alteryx Alumni (Retired)

Hi @MMG 

 

Try this statement:

 

 

IF [Ending Balance Trx CCY]= 0 OR [Trx CCY]="USD"
THEN 1
ELSE [Ending Balance Func CCY]/[Ending Balance Trx CCY]
ENDIF

 

 

Be sure to pay attention to datatypes. The datatype for the new field should be numeric. The datatypes for [Ending Balance Trx CCY] and [Ending Balance Func CCY] should also be numeric. [Trx CCY] should be a string.

 

I hope I interpreted this correctly. If there are any questions, let me know!

 

Luke

MMG
5 - Atom

That was the solution thank you very much!

Labels