community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Creating new column based off other columns and rows

Hello,

 

To preface, I am very new to alteryx and have some issues. I have a table, and I need to create a new column based off of the relations between other columns. 

 

If we had a table like this, 

ABC
123 Abby
456 Daniel
456  
123Hello 
 Hello 

 

then my desired result would be

ABCFinal
123 AbbyAbby
456 DanielDaniel
456  Daniel
123Hello Abby
 Hello Abby

 

 

The value in column C takes priority, if it exists then it will populate the Final Column for that row. However, if it does not exist then based off of associations, for example, since 123 in A is associated with Abby in C, then all rows with 123 in the A column will have populate the Final column with Abby. Then later, since 123 is associated with Hello in B, then all Hello in B will populate the Final column with Abby.

 

Again I'm new to Alteryx, so I'm looking for some guidance on how this would be done in Alteryx. Thanks so much

Highlighted
Bolide

Hi @vincent_le,

 

I suggest to do it this way:

 

1) filter for records that are not null for columns A and C to allow you to derive name from id

 

img2.JPG

 

2) filter records that are not null for columns B and A and derive name from previous step

 

img3.JPG

 

3) get final name from the following formula: 

 

IF Not IsNull([C]) THEN [C]
ELSEIF Not IsNull([name_from_id]) THEN [name_from_id]
ELSEIF Not IsNull([name_from_text]) THEN [name_from_text]
ELSE NULL() ENDIF

 

'source' column is derived in the same way and gives clarity for where the name is coming from.

 

img1.JPG

Thanks,

Rafal

 

#Excuse me, do you speak Alteryx?

Alteryx Certified Partner

Here's another way to do it,

 

Screenshot (4).pngworkflow

Labels