Forum Discussion
bergen288
Helper IV
3 years agoUse DATEDIFF function to calculate session gap between previous end time and current start time
I have a table visual as shown below where Created_TS is the session start time and Created_TS_End is session end time. I would like to use DATEDIFF function to calculate session gap between previou...
Jihwan_Kim
Super User
3 years agoHi,
I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.
Please chech the below picture and the attached pbix file.
It is for creating a calculated column.
Expected result CC =
VAR _prevstart =
MAXX (
FILTER ( Data, Data[Created_TS] < EARLIER ( Data[Created_TS] ) ),
Data[Created_TS]
)
VAR _prevend =
MAXX ( FILTER ( Data, Data[Created_TS] = _prevstart ), Data[Created_TS_End] )
VAR _start = Data[Created_TS]
VAR _diffinminutes =
DATEDIFF ( _prevend, _start, MINUTE )
RETURN
_diffinminutes