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! Request now

Reply
mgirou
Helper II
Helper II

Calculating total hours based on logs

Hello,

 

I have a set of data for a entry system where we swipe in and out of the office. What i am trying to get is the total time that people are at the office for on each day. The issue i come into is when someone comes into work then leaves for lunch then comes back in then leaves for the day. (Yellow Highlighting).

Could anyone help me at getting the Total hours that people where at the office for?

 

ThankssCapture.PNG

1 ACCEPTED SOLUTION

lets'c if this do the job, there is paramter in the file , change value in paramter to point to you excel sheet.

 

https://drive.google.com/file/d/15huP3OEpBv-Fkmv9liqd8sh9caAz1oYq/view?usp=sharing



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

16 REPLIES 16
parry2k
Super User
Super User

@mgirou can you provide the sample data in excel sheet to work on the solution?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

How do i attach files to this?I can't seem to figure it out...

@mgirou you cannot attach file here with the post, you need to share it using google drive or dropbox etc.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Try it now.

Does EXT is in and INT is out?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yes

lets'c if this do the job, there is paramter in the file , change value in paramter to point to you excel sheet.

 

https://drive.google.com/file/d/15huP3OEpBv-Fkmv9liqd8sh9caAz1oYq/view?usp=sharing



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I am having one issue though, when you just want to see the total hours  for each member on each date the time in office hours uses the last time they swiped out and subracts it from the first time they swiped in for the date. Instead of just grab each individual time they swiped in and out and adding those times.

Will check, didn't tested all the use cases. it was more of a concept for you to make changes as you see fit.

 

Anyhow, will look at it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

can you give me example employee and date, and expected result, it will help me to debug



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k, I hope i am not bugging you but i have really hit a road block trying to get this done. did you get a chance to look at it?

@parry2k. I was wondering if you had a chance to see if there was a solution for seeing the total hours in office per date.

Member ID 495. October 31

 

I want to be able to have a table just with Member Id, Date, and time in office in hours

 

Now i get 15.47 hours (because its taking the min date which is date they entered and max date which is last date the left. but because they left and came back during the day its wrong) which is wrong. it should be 7.6

 

Thanks!

This is amazing.. thank you very much!! I was wondering if you could help me understand how you did this??

 

In Time for This out time Measure - I know your filtering the table the way you want it but i dont completely understand whats going on there.

Whats the point for Rank Calc Column?

Why use Var x? do you need to declare variable like that or is that best practice??

 

 

Thank you very much again.

 

 

your excel file has all the data in one column, is that how you get the data or it is just an error in file you shared.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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