Alteryx Designer Desktop Discussions

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

adding conditions in new column

ll1100000
8 - Asteroid

Column [item type] is my raw data, and I used formula function to add an new blank column called [item desc]

However, I want the item desc align up with item type according as below

Item type in (1,7,33) = Domestic

item type in (13,25) = DSD

item type in (15,40) = Import

 

Item TypeItem Desc
1Domestic
7Domestic
33Domestic
25DSD
13DSD
40import
15import

 

Currently, I am using filter function to separate the data into three groups and then re-union them together...

Is there a better way to do this?

Thank you.

3 REPLIES 3
JoshKushner
12 - Quasar
You can use a formula:
IIF([Item Type]=1 OR [Item Type]=7 OR [Item Type]=33, "Domestic", IIF([Item Type]=13 OR [Item Type]=25, "DSD", IIF([Item Type]=15 OR [Item Type]=40, "Import")))
jdunkerley79
ACE Emeritus
ACE Emeritus

You could use a Find and Replace tool with the table you have to append the additional column.

 

 

jrgo
14 - Magnetar

@ll1100000,

 

you've already done most of the work. :)

 

[item desc] =
IF [Item type] IN(1,7,33) THEN 'Domestic'
ELSEIF [Item type] IN(13,25) THEN 'DSD'
ELSEIF [Item type] IN(15,40) THEN 'Import'
ELSE 'NO DESCRIPTION'
ENDIF

Drop this into your the field you created in the Formula tool.

 

Best,

 

Jimmy

Labels