Forum Discussion
Anonymous
8 years agoNot applicable
Help with Measure
Hi, I need help from you guys for calculating the difference between two time stamps , below is as example of the exact output that I need. Appreciate your help ! ID Time Received Action ...
- 8 years ago
Hi Anonymous,
glad it worked out for you. For formatting the result, you may find these additional measures useful:
DiffMinutes = QUOTIENT([Diff], 60) DiffSeconds = [Diff] - [DiffMinutes] * 60 DiffMinSec = [DiffMinutes] & "." & FORMAT([DiffSeconds],"00")
If all you need is the [DiffMinSec] you can fold it together as:
DiffMinSec = QUOTIENT([Diff], 60) & "." & FORMAT([Diff] - QUOTIENT([Diff], 60) * 60,"00")
nickchobotar
8 years agoSkilled Sharer
Hello,
Zubair_Muhammad very elegant solution.
I took a longer path to the solution. Here is my take on this.
EVALUATE
SELECTCOLUMNS (
ADDCOLUMNS (
ADDCOLUMNS (
Table1,
"PreviousRow", CALCULATETABLE (
VALUES ( Table1[Time Received] ),
FILTER ( ALL ( Table1 ), Table1[Index] = EARLIER ( Table1[Index1] ) )
)
),
"Subtract", MINUTE ( ( Table1[Time Received] - [PreviousRow] ) )
),
"Time Received", Table1[Time Received],
"Action", Table1[Action],
"Minutes Out", IF ( Table1[Action] = "Out", [Subtract], 0 )
)