Using Interval to count #minutes between rows in same date field
I'm using Interval() to count the number of minutes or days between the same date field (Date1) within the same ID.
Date1 and Date2 have the following format:
Date(Date#(Date1, 'DD-MMM-YYYY hh:mm'),'DD-MM-YYYY hh:mm') as Date1
Date(Date#(Date2, 'DD-MMM-YYYY hh:mm'),'DD-MM-YYYY hh:mm') as Date2
The Interval expression are defined like this:
Interval(Date2 - Date1,'mm') as IntervalA
If(ID = Previous(ID), Interval(Date1 - Previous(Date1),'mm')) as IntervalB
The Interval function does not apply across rows whenever the calculation is not withing the same day. I would like to achieve the output in IntervalC.
Is there a way to still use Interval() and get the output in IntervalC? Any other methods are appreciated as well.