Alteryx Designer Desktop Discussions

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

Conditional IF formula - Need Help Please

CDIns
8 - Asteroid

Trying to create a new field based on the data in my other columns. My 3 existing columns are Region, Product & Store. 

 

If the Region= 1 then I need the new column to say "Corporate"

If the Region = 2 then I need the new column to say "Affiliate"

If the Product = "***" then I need the new column to concatenate the Store + "Unknown"

 

If none of the 3 conditions above are met, I need the new column to simply concatenate Store and Product. 

 

My syntax is as follows:

 

if [Region]=1 then "Corporate" elseif [Region]=2 then "Affiliate" elseif [Product]="***" then tostring([Store])+"Unknown" else tostring([Store])+[Product] endif 

 

It seems like my formula is breaking down when I get to the 3rd condition. For reference, my Store column is Double so I am adding tostring() before concatenating. 

 

Where am I going wrong? 

 

Thanks in advance, 

 

5 REPLIES 5
Bren_Spill
12 - Quasar

@CDIns - this looks good assuming Product is a string and Region is numeric. Can you provide some data?

binuacs
20 - Arcturus

@CDIns i don't see any issue with your formula. Can you screen shot the error here?

IF [Region] = 1 THEN
    "Corporate"
ELSEIF [Region] = 2 THEN
    "Affiliate"
ELSEIF [Product] = "***" THEN
    toString([Store]) + " Unknown"
ELSE
    toString([Store]) + " " + [Product]
ENDIF

 

Bren_Spill
12 - Quasar

@CDIns - See attached

CDIns
8 - Asteroid

Hi Bren, 

 

Thank you for the quick reply- I'm not sure what the issue was. I deleted the formula tool and re-added it now it works fine. Thanks, anyways!

CDIns
8 - Asteroid

Hello, 

 

Thank you for the quick reply- I'm not sure what the issue was. I deleted the formula tool and re-added it now it works fine. Thanks, anyways!

Labels