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! Request now

Reply
Tim_Groothuis
Regular Visitor

Calculating a time difference based on two times spread over two tables

Hi there,

 

I'm fairly new to PowerBI, so it might be a dumb question. I have the following tables:

Tim_Groothuis_2-1712243544626.png

 

Sentinel-incidents contain security incidents from our system. A single incident might have one or more comments and tasks associated with it. I've added a one-to-many relation from the sentinel-incidents table on the IncidentName (which is a unique value). We have a system which automatically adds a sentinel-task with the title "ACKNOWLEDGED" to an incident once we've begun working on it.

 

I'd like to get for each Sentinel-Incident the associated Sentinel-task the title "ACKNOWLEDGED", and get the time difference between the CreatedTimeUtc of the sentinel-incident and the CreatedTimeUtc of the sentinel-task. That'll serve as our response time and ties into our SLA.

 

Currently, I tried to add a column to the sentinel-incidents table using the following query. The query isn't working and probably quite wrong, so all help is appreciated.

Tim_Groothuis_0-1712243960816.png

 

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Tim_Groothuis , Try a measure like

 

AverageX('Sentinel-incidents', datediff(min('Sentinel-task'[CreatedTimeutc]), max('Sentinel-comment'[CreatedTimeutc]), MINUTE))

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Tim_Groothuis , Try a measure like

 

AverageX('Sentinel-incidents', datediff(min('Sentinel-task'[CreatedTimeutc]), max('Sentinel-comment'[CreatedTimeutc]), MINUTE))

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

Hi @amitchandak,
Awesome! That's exactly what I'm looking for, thanks for the help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors