Calculating Time Between Start of One operation and End of the previous operations

New Contributor
I am trying to achieve this task using excel Power Query.

I am trying to do a transformation on a data set that has Work Orders. So there are multiple Routing IDs. With each Routing ID there are one or More versions. For each version there are Multiple Work Orders. For each work order there are set of operations that are unique to the version ID. Now I need to:
Task 1: Find out wait times between these operations over all WO history
Task 2: Determine a simple average for the time between all Operations unique to the Version ID.

For task 1 I need to calculate the time difference between end of One operation to the start of the next operation for all the steps within that work order. Then Continuing doing this for rest of the work orders within the data set. I really do not know how To manipulate the data to achieve this take.

Kindly advise if I should provide data set as well. Thank you!
2 Replies


If I understood your question, you may follow these steps...

  1. You can create a Reference of the existing query.
  2. Then insert an Index column starting from 1 in the original query.
  3. Insert an Index column starting from 0 in the Referenced query.
  4. Then merge both the queries on Index Columns and extract the Start Time Field from the reference query.
  5. Now in the merged query you will have start time for one operation and start time of the next operation in the same row and you may then add a new column subtracting both the times.


Dear Subodh
Thank you so much! I will test this solution and will update you shortly.