Forum Discussion
villa1980
1 year agoResolver II
Time Duration between rows
I am trying to look at the duration between the end date and next start date for each STARTDATE category. I am using the below DAX and is coming out with some weird results which I am struggling to ...
rajendraongole1
1 year agoSuper User
Hi villa1980 - You can rewrite the measure using TOPN
NextRow_CALC =
VAR _CurrentTaskTime = SELECTEDVALUE(AVAILABLE_DIARY_DATE_inc_Start_Date[STARTDATE])
VAR _NextTaskTime =
CALCULATE(
MIN(AVAILABLE_DIARY_DATE_inc_Start_Date[STARTDATE]),
FILTER(
ALL(AVAILABLE_DIARY_DATE_inc_Start_Date),
AVAILABLE_DIARY_DATE_inc_Start_Date[STARTDATE] > _CurrentTaskTime
)
)
VAR _TimeDifference =
IF(
ISBLANK(_NextTaskTime),
BLANK(),
DATEDIFF(_CurrentTaskTime, _NextTaskTime, DAY) -- Use DAY, or adjust as needed
)
RETURN
_TimeDifference
Hope this works.