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
AntonioCarl
Helper I
Helper I

Help needed with Power Query query which calculates working hours

Hi, 

I've got a table 

Employee_idDateTimeType
63002.01.2024 00:00:0009:45:50IN
63002.01.2024 00:00:0017:02:40OUT
63013.02.2024 00:00:0016:06:30OUT
63017.09.2024 00:00:0006:37:50IN
63017.09.2024 00:00:0008:07:30OUT
63017.09.2024 00:00:0008:21:00IN
63017.09.2024 00:00:0016:20:00

 

 

 

 

For each employee_id and each date I need to find IN and OUT pairs. 

If there's pair IN and OUT return IN and OUT in pair-rows. In my example theres going to be one row for 02.01.2024 but two rows for 17.09.2024 and it means that employee left company in middle of the day. 

Theres also case that he forgot to Clock in or clock out. Then I need to add proper description to new column. 

I've tried to do write it myself  but failed 😞 


What I want to achieve is basically something like that. 

Employee_idDateINOUTDESCRIPTION
63002.01.2024 00:00:0009:45:5017:02:40 
63013.02.2024 00:00:00null16:06:30NOT CLOCKED IN 
63017.09.2024 00:00:0006:37:5008:07:30 
63017.09.2024 00:00:0008:21:0016:20:00 
2 REPLIES 2
Anonymous
Not applicable

Hi,amitchandak .thanks for your concern about this issue.

Hello,@AntonioCarl .

Has your problem been solved?
If you have found suitable solutions, please share them as it will help more users with similar problems.
Or you can mark the valid suggestions provided by other users as solutions.
Thank you very much for your understanding and support of Power BI.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



amitchandak
Super User
Super User

@AntonioCarl , First you can Pivot data using Type and Time tbale. 

 

Then you can have an additional column in power query

 

= if [out] = null then "NOT ClOCKED IN" else ""

 

Pivot Data(Power Query) :https://www.youtube.com/watch?v=oKByyI09Bno&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=12

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

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