Forum Discussion
Time Difference Between two resources
Phil_SeamarkI don't think so this is what I want. If you look at the column "Time Spent" and the difference between end time for resource 11 and start time for resource 12 is 00:1:53 seconds and not 5 mins and 30 seconds.
This is the problem, I hope I am a bit more clear now.
Thank You for your quick reply BTW.
And it would be really appreciated if we can do this without going into the query, if possible and by just adding a column.
Thank You,
Kumar Ashwarya
Hi Kumar Ashwarya,
According to your conditions, the records in this table should have an order. So firstly, we add an index column. Then we can use this formula in calculated column to get the time spent.
TimeSpent =
VAR NextStartTime =
CALCULATE (
MIN ( Table1[Start Time] ),
FILTER (
Table1,
Table1[Index]
>= EARLIER ( Table1[Index] ) + 1
&& Table1[Session ID] = EARLIER ( Table1[Session ID] )
)
)
RETURN
IF ( ISBLANK ( NextStartTime ), BLANK (), NextStartTime - Table1[End Time] )Ps: 1. Column NextStartTime is just to show the process, you don’t need to add it.
2. Pay attention to the data type.
- Kumar111099 years agoHelper IV
I tried using your method, but it is showing errors.
The error is "Token Eof expected".
Do I need to create this column out of the query or in the query editor only?- v-jiascu-msft9 years agoMicrosoft Employee
Hi,
We add index in the Query Editor. And then add a calculated column in the table with the formula. These two steps are performed in different place. The error showed whether you were in the wrong places or you missed some parenthesis (usually right parenthesis). Please check it out.
Best Regards!
Dale