Max value in a column
![deep_215](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar20.png)
Hi,
My requirement is to find the max value of a column and the add that max value will be populated against each row in the dataset as a new column.
For e.g.
Existing dataset
col1 | col2 | col3 |
1 | 23 | ABC |
1 | 17 | GDFT |
1 | 25 | HDG |
1 | 35 | HDI |
here 35 is the max value for col2. hence it needs to get populated in a new column. new dataset will be as below
col1 | col2 | col3 | col4(New Column) |
1 | 23 | ABC | 35 |
1 | 17 | GDFT | 35 |
1 | 25 | HDG | 35 |
1 | 35 | HDI | 35 |
please help me to get away with this problem. Thanks in advance
Regards,
Deepak
Best Answer
-
I used window recipe and was able to fulfill my requirement. i did sorting in descending order on required column and then took first value of that column from aggregate list. with this final result was achieved
Answers
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron
Wondering if you might want to use a window recipe. From the data you are showing it appears that col1 has the same value all the way down.
This community post might be of help
https://community.dataiku.com/t5/General-Discussion/WINDOW-RECIPE-SUM/m-p/11262
This knowledge base article might also help.