Forum Discussion

Adham's avatar
Adham
Helper III
6 years ago

Calculate time between dates for each unique identifier

Hello All,

 

I have been stuck with this issue for a while and i would appreciate some help. I have got the following table.

 

IDDate
116/07/2020 14:11:12
117/07/2020 15:12:11
116/07/2020 15:32:44
116/07/2020 17:11:24
219/07/2020 06:11:12
219/07/2020 12:12:11
220/07/2020 14:32:44
220/07/2020 02:11:24

 

I would like to calculate the time by using the minimum value for each ID and subtracting it for rows that hold the same ID. However, i want the format to be in hh:mm:ss where if the difference is more than 24 hours it would be 37:44:22 for example.

 

Here is how i would like the results should look like.

 

IDDatetime
116/07/2020 14:11:12  00:00:00
1

17/07/2020 18:32:23  

28:21:11
116/07/2020 18:32:44  04:21:32
116/07/2020 17:11:24  00:00:12
219/07/2020 06:11:12  00:00:00
219/07/2020 12:12:12  06:01:00
220/07/2020 14:32:44  26:20:32

 

I would prefer to do in the power query, as i tried doing something similiar in DAX, and after uploading it to power bi service the time axis isnt as expected as it assumes 00:00:00 is 12:00 AM. If done in power query the column type could be changed however.

8 Replies