Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Assign Column value based on multiple Columns

kshah23
5 - Atom

I am trying to assign a value for Column4 based on the grid below for the 3 columns, there are approximately 30 combinations(and growing).

 

I am trying to assign the value using Formula calc (IF ([Column3]=Null() AND [Column2]="B" AND [Column1]="C") then "D" ENDIF) but want to see if there is a better way of doing this other than a large IF function in alteryx- something similar to list comprehension in python.

 

 

Column1Column2Column3
ABC
DEF
DBC
FEA
CDB
A  
CB 
EFA
2 REPLIES 2
pedrodrfaria
13 - Pulsar

Hi @kshah23 

 

If there are many conditionals and no straight forward logic, you would need to write it like this.

 

An alternative is to have a reference input with the logic and use a join to bring in the information for Column 4. I added an example below.

 

pedrodrfaria_0-1612964997428.png

 

In this example, the bottom input is a reference list that if the data from Column 1, 2 and 3 are the same, then it will bring the info on Column 4. I used the logic you mentioned ((IF ([Column3]=Null() AND [Column2]="B" AND [Column1]="C") then "D" ENDIF)). I use the Join to match all 3 columns, so the same concept as a IF function would, but this way you do not need to write a bunch of IF, you can have it in a table format which is a lot easier to create.

 

Pedro.

kshah23
5 - Atom

Thank you Pedro. That did it.

Labels
Top Solution Authors