Survey banner
The Dataiku Community is moving to a new home! We are temporary in read only mode: LEARN MORE

difference between rows

codewizard
Level 1
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 ?

0 Kudos
1 Reply
tgb417

@codewizard 

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:

https://community.dataiku.com/t5/Using-Dataiku/How-to-calculate-day-difference-between-rows-with-spe...

Or

https://community.dataiku.com/t5/Using-Dataiku/Multi-row-formula/m-p/26927 

--Tom
0 Kudos