title: Power query; how do i bring the value for one column in the previous row, or column in the next row, while matching criteria in current row columns?
body: <p>I have a table with many columns, there is a row for every interaction happening where the case changes from person to person (or queue); example below:</p>
  <p><a href="https://i.stack.imgur.com/YOU5k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YOU5k.png" alt="enter image description here" /></a></p>
  <p>I am attempting to get the time a case was with an agent, or in a queue.
  to do this, i need help in bringing in the date stamp in the next instance where a case changes owner, and do the time calculation between the &quot;interaction createdDate&quot; from the next interaction and current . I need a final table to look like image below:
  <a href="https://i.stack.imgur.com/OXSWY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OXSWY.png" alt="enter image description here" /></a></p>
  <p>is there a way to do this in powerquery without duplicating and indexing the tables? or Dax that i would use to say:
  If next row matches caseID get &quot;Interaction CreatedDate&quot; from next row,  and then i can do the calculation to tell me the time spent with current owner in the row?</p>