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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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