Shift sales variations
![DaitakuNapoleon](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar12.png)
DaitakuNapoleon
Registered Posts: 9 ✭✭✭✭
Good morning all,
I have a problem with the "windows" recipe. As you can see from the screenshots I calculated the difference in sales between each month.
However, I would like to "shift" the variations in sales: to put it simply, the month of March would contain the variation between February and January. The month of April the difference between March and February etc ... You will find a model of what I want to do in attachment.
Is it possible to do this with Dataiku?
Thank you in advance.
I have a problem with the "windows" recipe. As you can see from the screenshots I calculated the difference in sales between each month.
However, I would like to "shift" the variations in sales: to put it simply, the month of March would contain the variation between February and January. The month of April the difference between March and February etc ... You will find a model of what I want to do in attachment.
Is it possible to do this with Dataiku?
Thank you in advance.
Answers
-
Ignacio_Toledo Dataiku DSS Core Designer, 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: 412 Neuron
I would do a second window function after the first one. So, take the "Windows result", then apply a "Windows Recipe" where the partitioning column is "City" and the ordering columns are "Year" and "Month".
Then in the "aggregations" step, select "Lag" for the column "Sales_lag_diff", and then rename it to "Variations" so you get the result with the name you have in your model screenshot.
I wasn't able to make it in one step, unless I use a python recipe to do the trick.
good luck!