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! Learn more

Reply
TaariqHussain
Helper I
Helper I

Getting Total time worked for working hours based on clock ins

Good day

 

I am trying to get total time worked for employees from our clock in machines,

how do i calculate the total time worked

Snippet below of sample data

TaariqHussain_1-1704373933272.png

 

1 ACCEPTED SOLUTION

hi, @TaariqHussain 

try below code 

 

Column = 
var a = HOUR('Table'[Clock out])-HOUR('Table'[Clock in])
var b = MINUTE('Table'[Clock out])-MINUTE('Table'[Clock in])
var c = SECOND('Table'[Clock out])-SECOND('Table'[Clock in])
return
a +(b/60)+(c/3600)

 

 

Dangar332_0-1704434572716.png

 

Dangar332_1-1704434604032.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.and don't forgot to give kudos.

 

View solution in original post

8 REPLIES 8
Dangar332
Super User
Super User

hi, @TaariqHussain 

try below

column = 
   sumx(
     filter(
       'Table',
       'Table'[emp#]=earlier('Table'[emp#])
     ),
     FORMAT('Table (3)'[clock out]-'Table (3)'[clock in],"hh:mm:ss")
   )

@Dangar332 Thank you, 

I am getting the error below

TaariqHussain_0-1704374861974.png

 

hi, @TaariqHussain 

 

column = 
var a = HOUR('Table (3)'[clock out])-HOUR('Table (3)'[clock in])
var b = MINUTE('Table (3)'[clock out])-MINUTE('Table (3)'[clock in])
var c = SECOND('Table (3)'[clock out])-SECOND('Table (3)'[clock in])
var d = a+ (b/60)+( c/3600)
return
   sumx(
     filter(
       'Table',
       'Table'[emp#]=earlier('Table'[emp#])
     ),
     d
   )

 

change value of decimal place because above code show time in HOUR

 

Thanks, that never give an error but is showing the data below which doesnt look right, on average its 8 hours a day

where do i change the value of decimel place

TaariqHussain_0-1704376644138.png

 

hi, @TaariqHussain 

provide data in table form 

copy data and paste in table form here

Megachicks Jarrison.xlsxDateEmp #NameNTShort1.52PPHPPHWClock inClock outModified DateTime worked
Megachicks Jarrison.xlsx29/12/2023TN01TAARIQ HUSSAIN9.230.02000007:31:0016:45:0029-Dec-23379
Megachicks Jarrison.xlsx27/12/2023TN01TAARIQ HUSSAIN8.420.83000007:25:0016:50:0027-Dec-23241

hi, @TaariqHussain 

try below code 

 

Column = 
var a = HOUR('Table'[Clock out])-HOUR('Table'[Clock in])
var b = MINUTE('Table'[Clock out])-MINUTE('Table'[Clock in])
var c = SECOND('Table'[Clock out])-SECOND('Table'[Clock in])
return
a +(b/60)+(c/3600)

 

 

Dangar332_0-1704434572716.png

 

Dangar332_1-1704434604032.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.and don't forgot to give kudos.

 

Hi @Dangar332 

 

Megachicks Jarrison.xlsxDateEmp #NameNTShort1.52PPHPPHWClock inClock outModified DateTime worked
Megachicks Jarrison.xlsx29/12/2023TN01TAARIQ HUSSAIN9.230.02000007:31:0016:45:0029-Dec-23379
Megachicks Jarrison.xlsx27/12/2023TN01TAARIQ HUSSAIN8.420.83000007:25:0016:50:0027-Dec-23241

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors