cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Zingoo
Frequent Visitor

Make a Shift Work Calendar

Hi. I'm making Shift Work calendar in powerapps.(4 groups 3 shift - A, B, C, D)

but I met a problem...

 

I want to make it like under picture.

Zingoo_0-1642237014133.png  >>>> Zingoo_1-1642237788368.png

 

 

Our Shift work order is Morning 3 days > rest 1 day > Swing 3 days > rest 1 day > Night 3 days > rest 1day .....

ex). 2022-01-01 - Morning : 'D group', Swing : 'A group', Night : 'C group'

       2022-01-02 - Morning : 'D group', Swing : 'A group', Night : 'B group' 

       2022-01-03 - Morning: 'D group', Swing : 'C group', Night : 'B group' .................

 

please help.. T-T..

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Zingoo :

According to your requirements, the schedule should be a cycle of 12 days.So the first step, I will first construct an auxiliary table as the basis for the loop.

ClearCollect(
  ALoop,
 {NO:1,Morning:"D",Swing:"B",Night:"C"},
 {NO:2,Morning:"D",Swing:"A",Night:"C"},
 {NO:3,Morning:"D",Swing:"A",Night:"B"},
 {NO:4,Morning:"C",Swing:"A",Night:"B"},
 {NO:5,Morning:"C",Swing:"D",Night:"B"},
 {NO:6,Morning:"C",Swing:"D",Night:"A"},
 {NO:7,Morning:"B",Swing:"D",Night:"A"},
 {NO:8,Morning:"B",Swing:"C",Night:"A"},
 {NO:9,Morning:"B",Swing:"C",Night:"D"},
 {NO:10,Morning:"A",Swing:"C",Night:"D"},
 {NO:11,Morning:"A",Swing:"B",Night:"D"},
 {NO:0,Morning:"A",Swing:"B",Night:"C"}
)

Next, use this formula to get the schedule for the whole year of 2022:

ForAll(
    Sequence(365,1,1),
    With(
        {TheRecord:LookUp(ALoop,NO=Mod(Value,12))},
        {
            Date:DateAdd(Date(2022,1,1),Value-1,Days),
            Morning:TheRecord.Morning,
            Swing:TheRecord.Swing,
            Night:TheRecord.Night
        }
    )
)

vbofengmsft_0-1642472788774.png

Best Regards,

Bof

 

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @Zingoo :

According to your requirements, the schedule should be a cycle of 12 days.So the first step, I will first construct an auxiliary table as the basis for the loop.

ClearCollect(
  ALoop,
 {NO:1,Morning:"D",Swing:"B",Night:"C"},
 {NO:2,Morning:"D",Swing:"A",Night:"C"},
 {NO:3,Morning:"D",Swing:"A",Night:"B"},
 {NO:4,Morning:"C",Swing:"A",Night:"B"},
 {NO:5,Morning:"C",Swing:"D",Night:"B"},
 {NO:6,Morning:"C",Swing:"D",Night:"A"},
 {NO:7,Morning:"B",Swing:"D",Night:"A"},
 {NO:8,Morning:"B",Swing:"C",Night:"A"},
 {NO:9,Morning:"B",Swing:"C",Night:"D"},
 {NO:10,Morning:"A",Swing:"C",Night:"D"},
 {NO:11,Morning:"A",Swing:"B",Night:"D"},
 {NO:0,Morning:"A",Swing:"B",Night:"C"}
)

Next, use this formula to get the schedule for the whole year of 2022:

ForAll(
    Sequence(365,1,1),
    With(
        {TheRecord:LookUp(ALoop,NO=Mod(Value,12))},
        {
            Date:DateAdd(Date(2022,1,1),Value-1,Days),
            Morning:TheRecord.Morning,
            Swing:TheRecord.Swing,
            Night:TheRecord.Night
        }
    )
)

vbofengmsft_0-1642472788774.png

Best Regards,

Bof

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,153)