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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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))

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))

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.