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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
twalsh0625
Advocate I
Advocate I

Active Minutes during time intervals

Hi Everyone,

Job has me back in Power BI after a long stint in Tableau and I'm up against a problem thats common in our company.

 

We have tables showing employee activity with a start and end time stamp and activity type, Below is a sample.

We would like to sum the total minutes/hours/seconds (units of time will be depenedent on user preference) that each employee spent in each state in each interval of time.

 

EmployeeDuration(Secs)Start TimeEnd TimeState
Arnold3005/4/2020 9:34:32 AM5/4/2020 9:39:32 AMActive
Arnold36005/4/2020 9:39:32 AM5/4/2020 10:39:32 AMLunch
Arnold18105/4/2020 10:39:32 AM5/4/2020 11:09:42 AMResearch

 

And so on.... we would like to display as (if filtered only to Arnold):

 

Interval (Start)Active SumLunch SumResearch Sum
9:00300  
9:30 1228 
10:00 1800 
10:30 5721228
11:00  582

 

 

With all the appropriate relationships for things like date and employee in tact.

 

I tried a few solutions found here but haven't gotten any to work. Any experience or insight is welcome.

 

thanks!

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @twalsh0625 

Could you tell me the rule to divide "Durations" for diffrent Intervals?

For example, how to divide Duration 3600 to 1228, 1800, 572?

 

Best Regards

Maggie

Hi, Thanks for the response. I acutally ended up solving this with a few glasses of wine and screams of rage:

 

Time_in_State = CALCULATE (
    SUMX (
        'Emp_Activity_Details',
        DATEDIFF (
            MAX ( MIN('Hours'[Interval_Start]) , 'Emp_Activity_Details'[Start_Time] ),
            MIN ( MAX('Hours'[Interval_end]), 'Emp_Activity_Details'[End_Time] ),
            SECOND
        )
    ),
    FILTER (
        'Emp_Activity_Details',
        'Emp_Activity_Details'[Start_Time] <=  MAX(Hours[Interval_end])
            && 'Emp_Activity_Details'[End_Time] >= MIN( Hours[Interval_Start] )
    )
)

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.