
Solved
How to calculate the average interval of days between payment activities?The calculation is represented below:

Best answer by janpeter.van.d
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?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.