Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

If Statement help with formula function

thalil
6 - Meteoroid
 

Hello, 

 

We are hoping to create a currency column for the output based on if a number is located in the "Recoverable Total CAD" or "Recoverable Total USD" column. For any amounts in the "Recoverable Total CAD" we want CAD to be displayed in the currency code column and USD for "Recoverable Total USD". Currently we have two formulas set up for this column but one formula appears to be overriding the other. The currency column chart is displaying all zeros except for the amounts that are "Recoverable Total USD". Please let us know how to fix this issue. 

 

Thank you 

2 REPLIES 2
SPetrie
13 - Pulsar

Dont split it into two statements. Your second if is overwriting the result of the first.

Just use one if statement

if [Recoverable Total CAD] then "CAD" elseif [Recoverable Total USD"] then "USD" else 0 endif

 

Edited to fix spelling also add, if you really want to use 2 statements instead of 1, update the second statement to be

if [Recoverable Total USD"] then "USD" else [Currency] endif

 

this version of the statement will output USD when appropriate, but not override CAD items that were already set.

 

PhilipMannering
16 - Nebula
16 - Nebula

Just ammending the above slightly to take care of the rogue quotation mark and allocating a number to a string field,

if [Recoverable Total CAD] then "CAD" 
elseif [Recoverable Total USD] then "USD" 
else Null() endif

 

I believe this will be "CAD" for any non-zero value of [Recoverable Total CAD], and only then be "USD for any non-zero values of [Recoverable Total USD]. Null if both are zero.

Labels