Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello all,
I would like to ask for help with calculation of time difference between specific rows in one table. I have this kind of data:
| DATE/TIME | RC | KEY |
| 7-10-20 6:00 AM | 1101 | 01 |
| 7-10-20 6:05 AM | 1102 | 01 |
| 7-10-20 6:10 AM | 1103 | 01 |
| 7-10-20 6:20 AM | 1101 | 04 |
| 7-10-20 6:25 AM | 1102 | 05 |
| 7-10-20 6:30 AM | 1103 | 06 |
| 7-10-20 6:30 AM | 1101 | 03 |
| 7-10-20 6:40 AM | 1102 | 03 |
| 7-10-20 6:50 AM | 1103 | 03 |
And what I want to do is to calculate time difference between rows with key - 04, 05, 06 and next row but with the same RC number. So my expected output is:
| DATE/TIME | RC | KEY | TIME DIFFERENCE |
| 7-10-20 6:00 AM | 1101 | 01 | |
| 7-10-20 6:05 AM | 1102 | 01 | |
| 7-10-20 6:10 AM | 1103 | 01 | |
| 7-10-20 6:20 AM | 1101 | 04 | 0:10 |
| 7-10-20 6:25 AM | 1102 | 05 | 0:15 |
| 7-10-20 6:30 AM | 1103 | 06 | 0:20 |
| 7-10-20 6:30 AM | 1101 | 03 | |
| 7-10-20 6:40 AM | 1102 | 03 | |
| 7-10-20 6:50 AM | 1103 | 03 |
* colors marked which rows are calculated
Thank you for your help in advance.
P
Solved! Go to Solution.
Finally I found solution. For those whom it can help:
Finally I found solution. For those whom it can help:
@Peter_2020 , Try a new column like
if([Key] in {"04","05","06"}, [Date/time], Maxx(filter(table,[RC] =earlier([RC]) && [Date/time] <earlier([Date/time])),[Date/time]), blank())
But I doubt you are doing diff with the same RC number
@amitchandak Thanks for your help but it doesn´t work. I forgot to mention that I am using DirectQuery mode.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 66 | |
| 64 | |
| 31 | |
| 26 | |
| 26 |