Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Create new field based on values in multiple columns of same row

Jashthebest
6 - Meteoroid

I have a dataset which looks like below. i want to create a new column that will show the type of pathway applicable for each row. For example, if Pathway_English is 1 only, then the new field (let's call it Pathway_Type) will show "English". If both Pathway_English and Pathway_Diploma have values as 1, then the Pathway_Type will be "English_Diploma". If all three are populated, then the new field will be equal to English_Diploma_Foundation. If all are 0, then the new field will be "No Pathway". Can anyone suggest a solution?

 

Pathway_Filter_Image.JPG

2 REPLIES 2
jasperlch
12 - Quasar

Hi @Jashthebest

 

The workflow should be quite dynamic (it should still work if you have extra columns on top of those 3):

Capture1.PNG

Jashthebest
6 - Meteoroid

Hi @jasperich,

 

Thank you so much for your reply. It surely resolves the issue. I tried the below functions but I believe my solution is more static and yours is more dynamic. But anyways, do you think there will be any issues with this solution. 

 

Function 1:

New Field (Pathway_Type)

IF [Pathway_English] > 0 THEN "English_"
ELSE ""
ENDIF
Field2IF [Pathway_Diploma] > 0 THEN [Pathway_type] + "Diploma_"
ELSE [Pathway_type]
ENDIF
Field3IF [Pathway_Foundation] > 0 THEN [Pathway_type]+"Foundation_"
ELSE [Pathway_type]
ENDIF
Field4IF IsEmpty([Pathway_type]) THEN "No Pathway"
ELSE Left([Pathway_type], Length([Pathway_type])-1)
ENDIF

 

Function_Map.JPG

 

Regards,

Sujan

Labels