Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
123CaM321
Frequent Visitor

Group timestamped events within x amount of time

Going crazy over this one. Someone has probably done it before
I have some date/time stamps for event ON and OFF as follows

Sometimes what is considered one event is actually recorded as more than one event.

[ON] [OFF]
14/09/2023 9:16 14/09/2023 9:53
14/09/2023 12:08 14/09/2023 12:59
15/09/2023 2:05 15/09/2023 2:24
15/09/2023 2:24 15/09/2023 2:34
15/09/2023 2:34 15/09/2023 2:35
15/09/2023 2:35 15/09/2023 2:43
15/09/2023 2:50 15/09/2023 3:35
17/09/2023 0:47 17/09/2023 1:15
21/09/2023 13:48 21/09/2023 14:20
21/09/2023 15:49 21/09/2023 16:00
23/09/2023 13:39 23/09/2023 14:30
24/09/2023 11:41 24/09/2023 12:22
26/09/2023 18:41 26/09/2023 19:26
5/10/2023 21:35 5/10/2023 22:23


What I'd like to do is aggregate the results of this table into another table that shows any events within say 80min of another, and report the total duration.


For example in the case of


[ON] [OFF] [DURATION] [DIFFERENCE FROM LAST ON]

14/09/2023 12:08 14/09/2023 12:59 50.9
15/09/2023 2:05 15/09/2023 2:24 18.65
15/09/2023 2:24 15/09/2023 2:34 9.7
15/09/2023 2:34 15/09/2023 2:35 1.1
15/09/2023 2:35 15/09/2023 2:43 7.8
15/09/2023 2:50 15/09/2023 3:35 45.53333333
17/09/2023 0:47 17/09/2023 1:15 28.06666667
21/09/2023 13:48 21/09/2023 14:20 32.85
21/09/2023 15:49 21/09/2023 16:00 11.21666667
23/09/2023 13:39 23/09/2023 14:30 50.5


A group would be


[ON] [OFF] [DURATION]
15/09/2023 2:24 15/09/2023 2:50 64.13


and the table would continue until it needed to bunch other events together as one.

Thanks!

 

 

2 REPLIES 2
123CaM321
Frequent Visitor

Thanks, this is useful for returning the difference from previous event but I'm still stuck on then aggregating these into groups

amitchandak
Super User
Super User

@123CaM321 , Difference with last off

 

datediff(maxx(filter(Table, [Off] < earlier([ON])), [OFF]), [ON], Second)

 

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors