Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Shift model

I would like to divide the work day into early (6 am- 2 pm),  late (2 pm- 10 pm) and night shifts (10 pm- 6 am). As you can see in the pictures.

Creating the night shift is no problem because it runs every weekday from 10pm - 6 am. IIt is difficult to create the early and late shift, because they change every week. In calendar week 48 group A has the early shift (6 am- 14 pm) and group B the late shift (2 pm- 10 pm). In calendar week 49 group B has the early shift and group A the late shift and so on.

I would be very grateful for helpful tips!

 

Code:

 

DataDate Table= Table.AddColumn(#"Renamed Columns4", "Schicht", each if [Zeitpunkt] <= #time(6, 0, 0) then "Nacht" else if [Zeitpunkt] <= #time(14, 0, 0) then "Früh" else if [Zeitpunkt] <= #time(22, 0, 0) then "Spät" else "Nacht")

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    For me it is not clear what your question exactly is. For instance you refer to Group A or B but (as far as I can see) there is no reference to groups in the pictures provided. 

     

    It's always better to provide some sample data (not is a picture but as a table that can be copied into PBI) and a "sketch" of the desired result.

     

    Jan 

  • rainer1's avatar
    rainer1
    Resolver III

    Hi Anonymous,

     

    I think for me it's clear enough.

     

    To Solve your Problem in Power query is realy hard - in Dax it would be a bit easier.

    You don't need your calculated Dates column to solve it because you have the dates in the data Table.

     

    The only Problem I have is how to decide if the person is in Group A or B.

     

    Because of that i can't give you an exact solution.

    May be you can share your table were the person is shown in which group he/she is.

     

    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!
    It was useful? Press Thumbs Up!