Forum Discussion
Calculating duration between two timestamps with millisecounds
- 1 year ago
Hi hish ,
can you try with below updated dax and let us know if you need anything else i think it will solve your issue
TimeDifferenceFormatted =
VAR CurrentTime = 'Machine Status Loops'[Zeitstempel]
VAR CurrentMachine = 'Machine Status Loops'[Maschine]
VAR NextTime =
CALCULATE (
MIN('Machine Status Loops'[Zeitstempel]),
FILTER (
'Machine Status Loops',
'Machine Status Loops'[Maschine] = CurrentMachine &&
'Machine Status Loops'[Zeitstempel] > CurrentTime
)
)
VAR Duration = NextTime - CurrentTime
VAR TotalMs = Duration * 86400000
VAR Seconds = INT(TotalMs / 1000)
VAR MilliSeconds = MOD(TotalMs, 1000)
RETURN
IF (
ISBLANK(NextTime),
BLANK(),
FORMAT(Seconds, "00") & "." & FORMAT(MilliSeconds, "000") & " sec"
)Regards,
Chaithanya.
This code does still not show me the time differences in milisecounds
Hi hish ,
can you try with below updated dax and let us know if you need anything else i think it will solve your issue
TimeDifferenceFormatted =
VAR CurrentTime = 'Machine Status Loops'[Zeitstempel]
VAR CurrentMachine = 'Machine Status Loops'[Maschine]
VAR NextTime =
CALCULATE (
MIN('Machine Status Loops'[Zeitstempel]),
FILTER (
'Machine Status Loops',
'Machine Status Loops'[Maschine] = CurrentMachine &&
'Machine Status Loops'[Zeitstempel] > CurrentTime
)
)
VAR Duration = NextTime - CurrentTime
VAR TotalMs = Duration * 86400000
VAR Seconds = INT(TotalMs / 1000)
VAR MilliSeconds = MOD(TotalMs, 1000)
RETURN
IF (
ISBLANK(NextTime),
BLANK(),
FORMAT(Seconds, "00") & "." & FORMAT(MilliSeconds, "000") & " sec"
)
Regards,
Chaithanya.