Forum Discussion

AntonioCarl's avatar
AntonioCarl
Helper I
1 year ago

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

  • Anonymous's avatar
    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.