Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Rotating Crew list

Hello Everyone,


Im new to powerapps and have come up with a bit of a head scratcher.


Im not sure if this is possible but would like to see if anyone knows how it would work.


Here is what I am wanting to do:

I want to have a "crew list", (two people per crew/ different positions ie. supervisor , worker)

When crew is "selected" (Button activated) for a task that slot now becomes open and slot two moves up.

When crew is "finished"  (Button activated) crew then takes next open slot.


 SupervisorPump Operator
1st crewDonMark
2nd crewBobJoe
3rd crewBillyMatt
4th crewDaveEthan
5th crewTomCurt
6th crewFrankNed
7th crewRoscoCletus
8th crewDanFred

Perferbly to have click select in app, least amount of typing for end user.

Not applicable



Here is a good start to your app. It may not be pretty but it works.


Here is what we start with and it can run in the OnStart property of the app:

ClearCollect(CachedCrew,{CrewNumber:1, QueuePosition: 1, State: 0}, {CrewNumber:2, QueuePosition: 2, State: 0},{CrewNumber:3, QueuePosition: 3, State: 0}, {CrewNumber:4, QueuePosition: 4, State: 0},{CrewNumber:5, QueuePosition: 5, State: 0}, {CrewNumber:6, QueuePosition: 6, State: 0},{CrewNumber:7, QueuePosition: 7, State: 0}, {CrewNumber:8, QueuePosition: 8, State: 0})


Now create 8 buttons.

The Text property of button 1 is: "Crew " & LookUp(CachedCrew,QueuePosition=1,CrewNumber)

The Text property of button 2 is: "Crew " & LookUp(CachedCrew,QueuePosition=2,CrewNumber)

up to button 8.


I assumed Button 1 represents the "Next crew up", so the OnSelect property of Button1 is:


Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=1),{QueuePosition: 0}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=2),{QueuePosition: 1}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=3),{QueuePosition: 2}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=4),{QueuePosition: 3}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=5),{QueuePosition: 4}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=6),{QueuePosition: 5}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=7),{QueuePosition: 6}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=8),{QueuePosition: 7}); Patch(CachedCrew, LookUp(CachedCrew, QueuePosition=0),{QueuePosition: 8})


I put the State column in the collection for later use like State=0 meaning Waiting, State=1 meaning Working, for example.


Hope this helps you get started.

Thank you for your Reply @Anonymous, i will give it a try and see how it does. I plan on using it in a large app at some point, just trying to get each thing figured out then ill worry about tying it all together.


@Anonymousim stuck at where my collection gathers info from. Everything else seems to work except my collection is blank. 


Not applicable

The OnStart feature only works when you start the program. During development, if you add commands to the OnStart, then PowerApps will not run them. Two choices: add a button, copy everything in the OnStart property and paste it into the OnSelect property of the button, run the program, press the button, return to edit mode and delete the button. Now everything in the OnStart has been executed.


Option 2 is to save, publish and restart the program.

Continued Contributor
Continued Contributor

Handy tip #1:  You can also run the App | OnStart code by clicking on the elipses next to App and the following popup appears:


I found my issue right after I posted. I'm curious on how to make it not Sequentail, ex. Crew 3 may come back into rotation befor Crew 2.


Best way for me to explain is like a service ticket,   

You have crews, when crew 1 gets assigned to the ticket and the ticket goes active(button) they get pulled out of the list, and the following crews move up, then Crew 2 gets a ticket and goes, everything still happens with the list. 

Now here is where i get lost, Crew 2 gets done with their ticket first(actived by button) so they get in front of Crew 1.


the above coding that @Anonymous gave works for the next in line rotation only if they stay in order.

Not applicable

Hello Travis,


I have some thoughts on the rotation issue. I added the state column in the collection to handle it. 


If a crew was working, then their state would change from 0 to 1, for example. The state column would then be incuded in the criteria to rotate crews. 


I am headnig out for a few hours. Let's circle back in about 4 hours. Cool project. I am excited to see the final product.

awesome ill be around. Like I said earlier this is all parta much larger app that I am building, this is just a part that had me stumped. The gallery or data table that the crews are viewed in will be pulled into PowerBI for a live dashboard.

Helper III
Helper III


Did you ever find a resolution for this as I'm struggling with somthing similar


Helpful resources

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,909)