Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Creating Shifts based on Date and Time

Hi All:   I am trying to filter some performance data based on date and time. Here are the shift examples:   Example is based on 03/21/2022 9pm - 03/22/2022 5pm working day.   "AM Dispatch Wave...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    You can update the formula of your calculated column [SHIFT] as below:

    SHIFT = 
    VAR test =
        TIME ( HOUR ( 'OperatorTTP'[SESSION_START_TIME_LOCAL] ), MINUTE ( 'OperatorTTP'[SESSION_START_TIME_LOCAL] ), SECOND ( 'OperatorTTP'[SESSION_START_TIME_LOCAL] ) )
    RETURN
        IF (
            test >= TIME ( 7, 0, 0 )
                && test < TIME ( 15, 0, 0 ),
            "PM Dispatch Wave",
            IF (
                (
                    test >= TIME ( 0, 0, 0 )
                        && test < TIME ( 6, 0, 0 )
                        || test >= TIME ( 21, 0, 0 )
                            && test < TIME ( 23, 59, 59 )
                ),
                "AM Dispatch Wave",
                "What is this?"
            )
        )

    Best Regards