Forum Discussion
Production Time Analysis - Calculate Interval between sequenced Transactions.
- 2 years ago
Pr0ton ,
Create the following column
Rank = Rankx(filter(Table, Table[UID] = earlier([UID]) ), [Start Time])
diff = if([Rank] <>1, datediff(Maxx(filter(Table, Table[UID] = earlier([UID]) && Table[Rank] = earlier([Rank]) -1), [Start Time]) , [Start Time], second) )
Many Thanks, amitchandak. Its close but this is whats being returned.
I added as 2 columns, 1 for Rank, the other Diff? Is this correct?
The rank skips a line here and there, but I can see no missing lines in raw data. Diff is all negative when it dosent skip a rank.
Edited 5 mins later:- There must be missing lines as when i do a count of UID there are 43. I will do some more digging and come back to you. Thanks.
Hi Pr0ton
Would a measure like this help? It seems to work for me.
Interval =
VAR _CurrStart = SELECTEDVALUE( 'Data1'[Start Time] )
VAR _PrevClose =
CALCULATE(
MAX( 'Data1'[Completed Time] ),
FILTER(
ALLEXCEPT( 'Data1', 'Data1'[UID] ),
'Data1'[Start Time] < MAX( 'Data1'[Start Time] )
)
)
VAR _Diff = IF( _PrevClose, _CurrStart - _PrevClose )
VAR _Result = FORMAT( _Diff, "hh:mm" )
RETURN
_Result
Let me know if you have any questions.