Forum Discussion

Birdjo's avatar
Birdjo
Resolver II
8 years ago
Solved

Get value for next date based on a condition

Hello, Here is a sample dataset: It contains clock-ins and clock-outs of employees.  For some shifts like for Employee ID = 001, the shift starts at let's say 15:00 and ends at 00:00 so he...
  • v-ljerr-msft's avatar
    8 years ago

    Hi Birdjo,

     

    Based on my test, you should be able to use the formula below to create a calculate column to calculate shift exit time in your scenario. :smileyhappy:

    Shift Exit = 
    IF (
        Table1[Entry] > TIME ( 14, 30, 0 )
            && Table1[Exit] < TIME ( 1, 0, 0 ),
        CALCULATE (
            MAX ( Table1[Exit] ),
            FILTER (
                ALL ( Table1 ),
                Table1[Date]
                    = EARLIER ( Table1[Date] ) + 1
                    && Table1[Employee ID] = EARLIER ( Table1[Employee ID] )
            )
        ),
        Table1[Exit]
    )
    

     

    Regards