web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculating which shif...
Power Apps
Answered

Calculating which shift is working to change fill color of calendar gallery date

(0) ShareShare
ReportReport
Posted on by 22

Hi,

 

I am building a PowerApps for my departments holidays, I have been using Excel and I have a formula to determine which shift is working on each date as we are on a rolling 4 on 4 off shift pattern.

 

The formula I have been using is =IF(MOD((D100-DATE(2020,3,12))/8,1)<0.5,"Shift 1","Shift 2") - where D100 references a cell with the date in it, this was then copied across all relevant cells.

 

I have created a calendar gallery and what would like to do is change the color of the fill in a gallery depending on what shift is working on each date of the month.

 

Is this possible in PowerApps?

Any help would be much appreciated

 

Regards,

 

Damian  

Categories:
  • anasurielnh Profile Picture
    Microsoft Employee on at

    Hello @Damo10 

     

    Yes, this is possible. You can have a look at the TemplateFill property for your gallery and use a formula such as

     

    If(ThisItem.Status = "ShiftA", Green, Transparent)

     

     

    Let me know if this helps.

    Community Support Team - Ana Navarro

    If this post helps, please consider accepting it as the solution to help other members find it more quickly.

  • Verified answer
    Damo10 Profile Picture
    22 on at

    Hi,

    I think that I have managed to work it out, I have the below code in the Fill property in the gallery.

    It was not as straight forward as using the same formula from Excel as there were issues where it was calculating some blocks as 5 days instead of 4.

     

    Switch(Dropdown1.Selected.Value,1,If(ThisItem.Value=Today(),ColorFade(Yellow,80%),If(Or(Round(Mod((ThisItem.Value-Date(2020,3,12))/8,1)/0.1,0)<5,Round(Mod((ThisItem.Value-Date(2020,3,12))/8,1)/0.1,0)=10),LightCyan,LightGray)),2,If(ThisItem.Value=Today(),ColorFade(Yellow,80%),If(Or(Round(Mod((ThisItem.Value-Date(2020,3,12))/8,1)/0.1,0)<5,Round(Mod((ThisItem.Value-Date(2020,3,12))/8,1)/0.1,0)=10),LightGray,LightGreen)))

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard