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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
TimothyJames
Frequent Visitor

Sum of minutes in a datetable, when separate table has a datetime within the datetable's datetimes

Hi,

So I work in a factory and I have some data that I cannot figure out how to sum up.

Basically, the intent of this is to get "How many minutes did this person work on this machine out of the full 8 hour shift?"
This will allow me to get a ratio of utilization of our machines compared to what we expect.

 

We expected our employees to get 420 minutes of utilization per shift. (8 hours minus some breaks/lunch/etc)

 

So I have the dataset of inspections.

Inspections 

Inspection TicketStart TimeEnd TimeShift
18/3/2021 6:45 AM8/3/2021 6:55 AM1st
28/3/2021 7:30 AM8/3/2021 7:35 AM

1st

 

 

So on and So Forth.

 

I also have a datetime column that has this data

 

DateShiftShift Start TimeShift End TimeShift Start DatetimeShift End DatetimeMax Minutes Available
8/3/20211st12/30/1899 6:30 AM12/30/1899 2:30 PM8/3/21 6:30 AM8/3/21 2:30 PM

420

8/3/20212nd12/30/1899 2:30 PM12/30/1899 10:30 PM8/3/21 2:30 PM8/3/21 10:30 PM

420

8/3/20213rd12/30/1899 10:30 PM12/30/1899 6:30 AM8/3/21 10:30 PM8/4/21 6:30 AM

420

       

 

Here's what I would expect to see.

Minutes of Inspection Time =

iferror(
    SUMX ( inspections,datediff(Inspections[inspection_time_in],Inspections[inspection_time_out],MINUTE )
           ),blank()) 

Therefore 15 minutes of inspection time

I would also like to see 420 minutes of inspection time available.
15/420 = .035714 or 3.57% of 420

I have the minutes of inspection time done comfortable, but I cannot identify how I sum up available time if the inspection occured in that window of time.
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @TimothyJames ,

 

Step 1: Create a relationship between Inspections and datetime with shift column.

Step 2: Create a calculate column to Inspections.

_diff = DATEDIFF(Inspections[Start Time],Inspections[End Time],MINUTE)

Step 3: Create a measure.

Measure = SUM(Inspections[_diff])/SUM(datetime[Max Minutes Available])

1.PNG

 

Best Regrads,

Jay

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @TimothyJames ,

 

Step 1: Create a relationship between Inspections and datetime with shift column.

Step 2: Create a calculate column to Inspections.

_diff = DATEDIFF(Inspections[Start Time],Inspections[End Time],MINUTE)

Step 3: Create a measure.

Measure = SUM(Inspections[_diff])/SUM(datetime[Max Minutes Available])

1.PNG

 

Best Regrads,

Jay

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.