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 THEN ELSE Returning a "-1" when a particular value is 0

CNP-JessieT
5 - Atom

Hello, 

I am having trouble with an IF THEN ELSE formula. Here it is:

 

if then else.PNG

 

This formula is being directed to a "0" value for any item marked with and "H" in the sender/receiver column. Nevertheless, I keep getting a "-1" when the Sender/Receiver value is an "H" but my overall result is a 0. Not sure what is going on, any help?

 

I exported it to excel to show the problem:

Capture.PNG

 

thanks!

 

Jessie

 

4 REPLIES 4
grossal
15 - Aurora
15 - Aurora

Hi @CNP-JessieT,

 

I think some column names are misleading in the pictures shown, but that's probably not the issue.

 

Can you double check all data types and check if the 'H' has leading or trailing whitespaces?

 

Another thing I noticed. You don't need to write "[Total Incurred] = 0" if you have already select the column as the output column. Therefore you can simple say "THEN 0 ELSE ...." 

 

 

Best

Alex

 

PS: If possible, share some sample data so we can take a deeper look into the problem.

T_Willins
14 - Magnetar
14 - Magnetar

Hi @CNP-JessieT,

 

Your expression is written to deliver a True/False, which is why it is returning a -1 (True).  If you want to replace Total Incurred with a 0, then your formula should be IF [Sender/Receiver] = "H" THEN 0 ELSE [Total Incurred] ENDIF.  This expression tells it if True then make Total Incurred (the Output Column) 0.

CNP-JessieT
5 - Atom

Wonderful!!! Thank you!!! I fixed the formula, here is what I did:

Capture.PNG

 

Worked like a charm!!!

CNP-JessieT
5 - Atom

Thank you!!! I changed the formula and it worked!

Labels