Hi all! I am new to alteryx and needing some help with creating a new column which relies on a current column's info.
For reference this is redacted data I am using - the new column I need to create is Region which uses the info in Department:
Department | Region (NEW Column) |
ABC (US) | US |
DEF (US) | US |
GHI (Asia) | Asia |
So far, I have tried using the formula tool with the following expression:
Region = If [Department] = 'ABC (US)' then 'US' else 'US' endif
Region = If [Department] = 'DEF (US)' then 'US' else 'US' endif
Region = If [Department] = 'GHI (Asia)' then 'Asia' else 'Asia' endif
However, in the Browse tool my results in the Region column only state 'Asia'. Can someone advise how to get around this problem? I have a similar data set that I need to do this on as well which has more variables.
Thank you!
For the part after ELSE, you should just reference [Region] instead of a hardcoded value since you just want to keep the value if it doesn’t match your condition
Region = If [Department] = 'ABC (US)' then 'US' else [Region] endif
Region = If [Department] = 'DEF (US)' then 'US' else [Region] endif
Region = If [Department] = 'GHI (Asia)' then 'Asia' else [Region] endif
there are more efficient ways to do this but this should at least be the easiest fix to your problem!
I didn't realize you didn't have Region as a field before - in that case your first formula will be f [Department] = 'ABC (US)' then 'US' else Null() endif
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |