difference between rows
i have a data which has years, column, sales column,
i want to create another column difference which calculates the diffeence between the years , how can i do that an what formula should i use ?
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,603 Neuron
In Dataiku we do many things in a database like fashion not like a spreadsheet. Many databases do not guarantee an order for rows unless you specifically request it. So having a formula that references values in other rows before or after the current row can be challenging. This is because this concept of row ordering is not the general case inside of a database.
So for this type of use case where I’m trying to calculate values across rows. I have a tendency to use a window recipe. This recipe does work across rows.
You can learn more about the window recipie here:
https://knowledge.dataiku.com/latest/data-preparation/visual-recipes/concept-window-recipe.html
or here
https://knowledge.dataiku.com/latest/data-preparation/visual-recipes/tutorial-window-recipe.html
Here are some community comments on the same set of ideas:
Or
https://community.dataiku.com/t5/Using-Dataiku/Multi-row-formula/m-p/26927