Forum Discussion
Time Duration between rows
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.
Thank-you for the response, it is returning the below which is still not correct
- Anonymous1 year agoNot applicable
Hi villa1980 , hello ryan_mayu and rajendraongole1, thank you for your prompt reply!
Per my test, I could use the following measure to calculate the differences between startdate as shown below:NextTaskDuration = VAR _CurrentTaskStart = SELECTEDVALUE('Table'[STARTDATE]) VAR _NextTaskStart = CALCULATE( MIN('Table'[STARTDATE]), FILTER( ALL('Table'), 'Table'[STARTDATE]> _CurrentTaskStart ) ) VAR _TimeDifferenceInMinutes = IF( ISBLANK(_NextTaskStart), 0, DATEDIFF(_CurrentTaskStart, _NextTaskStart, MINUTE) ) RETURN _TimeDifferenceInMinutesResult:
You could also provide more details about your issue or upload a sample PBIX file for better troubleshooting.Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- villa19801 year agoResolver II
This is strange, I have the exact same DAX but has these strange returns. I have attached the pbix file
https://drive.google.com/file/d/1YWVZfHt1t1lodS6TxFmIt_U1Fk0js2Xb/view?usp=drive_link