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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Sum of Monthly working time

Hello all,

 

I want to say I have tried some guides for the following topic/problem but I could not get it working.

I am very thankful in advance for your help.

 

I renamed the example to "Me" but otherwise it is a real example of what data I got.

So basically what I need to show is the first login, last logout, working time per day, working time per month.

While the first 3 are no problem /// filtered by Name and Date

First Login = MIN([Time])

Last Logout = MAX([Time])

working time per day= MAX([Time])-MIN([Time]) 

 

The problem comes when I try to make a total per month, as MAX([Time])-MIN([Time]) will just find the biggest and smallest value in the whole month and calculate those.

I need to count the total which adds together the daily working times.

May I ask how to make that possible ?

Edit: Sorry for not mentioning that, do not mind the exact working time, minutes, seconds (as this will be over 24hours per month) , I am ok with a calculation by decimal numbers showing only hours.

 

DateNameTimeState
4/14/2020Me09:13:38Login
4/14/2020Me10:05:03Logout
4/14/2020Me10:11:18Login
4/14/2020Me11:02:33Logout
4/14/2020Me11:13:56Login
4/14/2020Me11:30:17Logout
4/14/2020Me11:51:29Login
4/14/2020Me14:15:24Logout
4/14/2020Me14:48:29Login
4/14/2020Me15:58:54Logout
4/14/2020Me17:16:12Login
4/14/2020Me17:16:39Logout
4/15/2020Me09:37:25Login
4/15/2020Me14:14:02Logout
4/15/2020Me15:11:00Login
4/15/2020Me17:32:49Logout

 

Thank you again

Lubos

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

First, create a datetime

Datetime = [Date]+[Time]

The use that in min max to get time
sumx(summarize(Table,table[Date],"_1",datediff(min[Datetime],max([Datetime]),hour)),[_1])

You can use AverageX

Summarize at date level to push the row context

 

Refer: https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...

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

First, create a datetime

Datetime = [Date]+[Time]

The use that in min max to get time
sumx(summarize(Table,table[Date],"_1",datediff(min[Datetime],max([Datetime]),hour)),[_1])

You can use AverageX

Summarize at date level to push the row context

 

Refer: https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...

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
Anonymous
Not applicable

Worked like a charm , thank you @amitchandak

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.