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 / Conditional format a c...
Power Apps
Answered

Conditional format a calendar

(0) ShareShare
ReportReport
Posted on by 1,151

Hi 
I am building a calendar app
On the MonthDayGallery1 i would like to add an icon to denote a colour that is repeated every 4 days. (shift rota)
Red

Green

White
Blue

 

I have added the icon that i would like to colour change the fill but working with dates is new to me.

 

Thanks 

Gary

Categories:
I have the same question (0)
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @gazzo1967 ,

     

    When you said the MonthDayGallery1, is it from the Calendar Screen template?

    If so, there should be a Label named Title5, showing the Days, and please set the Fill of Icon as follows:

    Switch(Mod(Title5.Text,4),0,Red,1,Green,2,White,3,Blue)

    Test Result:

    Snipaste_2020-05-28_13-47-52.png

    Hope this helps.

    Sik

  • gazzo1967 Profile Picture
    1,151 on at

    @v-siky-msft 
    Thank you for you help with this and i marked it Completed but i have made a small mistake and provide the wrong information (sorry)
    Your suggestion works fine until you start a new month and it restarts the colour coding from red.

     

    This isn't how i would like it to work.
    The way i would like it to is

    and this is where i made my mistake in the explanation is 

     

    If the date is (in dd/mm/yyyy) 

    02/06/2020 (in dd/mm/yyyy) then 'White' 
    03/06/2020 (in dd/mm/yyyy) then 'White' 

    04/06/2020 (in dd/mm/yyyy) then 'Red'

    05/06/2020 (in dd/mm/yyyy) then 'Red' 
    06/06/2020 (in dd/mm/yyyy) then 'Green' 
    07/06/2020 (in dd/mm/yyyy) then 'Green' 
    08/06/2020 (in dd/mm/yyyy) then 'Blue' 
    09/06/2020 (in dd/mm/yyyy) then 'Blue' 
    Then the cycle starts again 

    10/06/2020 (in dd/mm/yyyy) then 'White' 
    11/06/2020 (in dd/mm/yyyy) then 'White' 

    12/06/2020 (in dd/mm/yyyy) then 'Red'

    13/06/2020 (in dd/mm/yyyy) then 'Red'
    Etc
    this cycle continues  and doesn't stop

    Gary 
    ps idid try to edit the formula myself but that gos back goes wrong in the cycle by restarting at the end of the month.
    Switch(Mod(Title2.Text,8),0,Blue,1,Blue,2,White,3,White,4,Red,5,Red,6,Green,7,Green)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 638

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard