Try your hand at analyzing royal sentiment in Dataiku DSS! Learn more

Shift sales variations

Level 2
Shift sales variations
 
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.
0 Kudos
1 Reply
Level 2

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!