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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,049)