Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Populate column based on value in another column

tanja90
7 - Meteor

Hi all,

 

Based on column Period, how to create new_column? In column Period values will change and not necessary in same row, but it will be same, so either Null or eg. August. I can't just hardcode value. 

Sorry if it's a basic question 😕

 

ProductPeriodNew_column
data1 August
data2 August
data3 August
data4AugustAugust
data5 August
data6 August
data7 August
7 REPLIES 7
AngelosPachis
16 - Nebula

Hi @tanja90 ,

 

This is not necessarily a straightforward question to answer. It will widely depend on the structure of your dataset.

 

So for example, if you have certain products for a single month, as in the example you provided, you can get away with an "Append fields" tool

 

AngelosPachis_0-1607681611051.png

However if you have multiple months for certain products, i.e your input would look something like that

 

AngelosPachis_1-1607681712427.png

 

then you should probably firstly create a field to group those records based on the month they belong to. Your solution would then include a "Join" tool instead.

AngelosPachis_2-1607681782815.png

 

Hope that helps, as I said it widely depends on your dataset I think. Let me know if you have any questions.

 

Regards,

 

Angelos

Qiu
21 - Polaris
21 - Polaris

@tanja90 

A simple way to do it.

1211-tanja90.PNG

AngelosPachis
16 - Nebula

@Qiu That looks very similar to my solution. Do you think that the duplication is helpful in this case?

Qiu
21 - Polaris
21 - Polaris

@AngelosPachis 


I dont consider it as a duplication

 

First, the order of Filter and Summarize tools are different, which reflects the thinking that non-useful data should be thrown away first.

Secondly, @tanja90 mentioned that the data is either Null or "August", either is not empty.

So the filter needs to be modified before any usage.

 

But I like the way of you making it more dynamic.

AngelosPachis
16 - Nebula

Oh I see, yes you are right @Qiu , it's best practice to first Filter and then Summarize in case of working with big data,

 

Setting the Filter expression to IsEmpty will remove Empty and Null values, so I don't consider that the filter needs any modification (apart from changing the annotation)

 

But it's useful that you have added that explanation on the why you might want to think to re-arrange those tools, so that will be helpful for people visiting the post

Qiu
21 - Polaris
21 - Polaris

@AngelosPachis Agree.

Will do more typing next time😁

tanja90
7 - Meteor

Thank you @Qiu  @AngelosPachis  for your replies.

I've implemented @Qiu 's solution, but both solutions worked nice.

Labels
Top Solution Authors