I am trying to display the difference between a start and end time in hh:mm:ss. The calculation doesnt seem to work properly.
I used the following code:
TimeDiff =
VAR FirstDateStart =
MINX ( unit_task_timestamps, unit_task_timestamps[NEW] )
VAR LastDateEnd =
MAXX ( unit_task_timestamps, unit_task_timestamps[TASK_STATUS_ENROUTE] )
RETURN
FORMAT ( LastDateEnd - FirstDateStart, "hh:mm:ss" )
Every row is getting the same value because the calculation is looking at all values/rows in the NEW
and TASK_STATUS_ENROUTE
columns and finding the minimum and maximum (this is what MINX and MAXX do, they look at the entire column). Try:
TimeDiff = FORMAT(unit_task_timestamps[TASK_STATUS_ENROUTE] - unit_task_timestamps[NEW], "hh:mm:ss")