In the event where you only have one date column but would like to calculate the difference between date rows, you can create an additional column to use as a start date in order to use the datediff formula. In the example below, we are looking to calculate the number of days between login times.
- After pulling in the column containing the login dates, add a new column in the data pipeline (here called ‘Signed On 2’) with the Formula Type “Lag” and a Row Offset of 1.
- Create a new column calculating the number of days between login dates using the datediff() formula below:
datediff(“DateColumn1”, “DateColumn2”, ‘unit’ (optional))
You now have the number of days between login dates and can perform additional calculations as needed.
Read more about date calculations in the data pipeline.