Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

gen new_var with labels for groups if other variables take certain values

johand_erst
7 - Meteor

Dear community,

 

How can I generate new_var based on ID, var1, and var2?

 

Note: the labels in new_var should not be composed of adding characters from var2. The labels can also simply be generated/written. For example, the label a_c could also be "option_five" or something arbitrary.

 

I seem to need to somehow test whether there is non-zero value in var1 for each var2 within each ID, and then attach a label (it is only 6 or so different values) to the ID.

 

IDvar1var2new_var
1114315aa
10ba
10ca
10da
214225aa_c
20ba_c
2343522ca_c
2 da_c
30ab
3423422bb
3nullcb
30db

 

Please let me know if you have questions.

2 REPLIES 2
binuacs
21 - Polaris

@johand_erst  are you looking for some thing like below. My logic is if there is a non numeric value in var1 based on Var2 and ID then flag with a value if leave it as null. Please let me know my understanding is correct or not?

binuacs_0-1641991221429.png

 

Qiu
21 - Polaris
21 - Polaris

@johand_erst 
I hope this is what you need.

CA1.PNG

Labels