Hi Ariane,
To calculate the difference between rows, you should use the LAG (celonis.com) function here. Assuming that your table only contains the payment rows, your code will be (please ignore bullets, I need them for indention)
- DAYS_BETWEEN (
- "<Table>"."Date Pay", -- Get date of current row
- LAG (
- "<Table>"."Date Pay" -- Get date of previous row
- , ORDER BY ( "<Table>"."Date Pay" ) -- Sort on dates
- , PARTITION BY ( "Table1"."Id" ) -- Only look for previous rows with the same ID
- )
- )
I do still not understand what you mean with average, since to calculate this, no average is needed?