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 😕
Product | Period | New_column |
data1 | August | |
data2 | August | |
data3 | August | |
data4 | August | August |
data5 | August | |
data6 | August | |
data7 | August |
Solved! Go to Solution.
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
However if you have multiple months for certain products, i.e your input would look something like that
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.
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 That looks very similar to my solution. Do you think that the duplication is helpful in this case?
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.
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
@AngelosPachis Agree.
Will do more typing next time😁
Thank you @Qiu @AngelosPachis for your replies.
I've implemented @Qiu 's solution, but both solutions worked nice.
User | Count |
---|---|
107 | |
85 | |
76 | |
54 | |
40 |