Forum Discussion

Rallmo's avatar
Rallmo
Helper I
2 years ago
Solved

Get data from next/previous row

Hi

 

I have a problem that I cant figure out how to solve, wasn't sure on where this is best solved (DAX or M-code) so therefore I put it under Desktop. 🤷‍

 

In our ticketing system I want to calculate the actual time a ticket is open. I have the requestDate when the ticket is created and the completionDate when we consider the ticket completed. Between those two dates its easy to just do a Datediff and be done with it. But I want to exclude the period when we are waiting for information from the end user. I have the start time for that under onHoldDate but I dont have the date and time for when the ticket is active again and we should stop considering the ticket as On Hold. 

 

So for every time the ticket is On Hold I would like to collect the timeStamp information from the following row and store it in a separate column preferably.

 

Do I need a index column to reference? Would you solve this is Power Query or with DAX? Is there a best practice I should use?

 

Here's a sample of what my data looks like.

 

timeStamp  ticketIdrequestDatecompletionDateonHoldDatestatusIdStatus
2023-07-20 14:24e17297772023-07-20 14:24  225ded26Logged
2023-07-25 12:35e17297772023-07-20 14:24 2023-07-21 07:434fbc9b46Waiting for user
2023-07-26 08:00e17297772023-07-20 14:24  1ee72955In progress
2023-07-26 08:00e17297772023-07-20 14:24  1ee72955In progress
2023-07-26 10:25e17297772023-07-20 14:24  1ee72955In progress
2023-07-26 10:26e17297772023-07-20 14:24  1ee72955In progress
2023-07-26 11:33e17297772023-07-20 14:24 2023-07-26 11:334fbc9b46-82efWaiting for user
2023-07-27 14:07e17297772023-07-20 14:24  1ee72955In progress
2023-07-27 14:08e17297772023-07-20 14:24  1ee72955In progress
2023-07-27 14:30e17297772023-07-20 14:24  1ee72955In progress
2023-07-28 07:36e17297772023-07-20 14:24 2023-07-28 06:554fbc9b46Waiting for user
2023-07-28 07:37e17297772023-07-20 14:242023-07-28 07:37 ca371597Completed
2023-07-28 07:37e17297772023-07-20 14:242023-07-28 07:37 ca371597Completed
2023-08-02 07:37e17297772023-07-20 14:242023-07-28 07:37 4350a7ddClosed

 

Thanks in advance!

2 Replies