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 / Change fill colour whe...
Power Apps
Answered

Change fill colour when date past

(0) ShareShare
ReportReport
Posted on by 18

Hello ,good evening. I have run in to a bit of a problem , so close.

 

Switch(
true,
DataCardValue14.SelectedDate < Today(), Color.Red,
DateDiff(Today(), DataCardValue14.SelectedDate, Months) >= 1, Color.Orange,
true, Color.White
)

In this formula when no conditions are met doesn't want to default to white , stays on orange ,

when due date has past todays date the red works . 

puzzled . 

any guidance appreciated please 

 

Categories:
I have the same question (0)
  • Verified answer
    DJ_Jamba Profile Picture
    2,837 Moderator on at

    Hi @Benson23 

    Could you try:

    If(
     DataCardValue14.SelectedDate < Today(), Color.Red,
     DateDiff(Today(), DataCardValue14.SelectedDate,TimeUnit.Months) >= 1, Color.Orange,
     Color.White
    )
  • Benson23 Profile Picture
    18 on at

    Hi @DJ_Jamba .

    thank you for replying , 

    have tried that formula previous , but still unable to default back to white , 

    very confusing !

  • Benson23 Profile Picture
    18 on at

    Benson23_0-1711578806223.png

    in above app the orange should be white ,mh/sa review is one year plus date from mh/sa . thought show the context .

  • DJ_Jamba Profile Picture
    2,837 Moderator on at

    It is working fine for me based on the scenario you posted.
    Can you try it out in a new screen with just a date picker and apply the code on the Fill property of a text label?

    See attached gif...

    FillCondition.gif
  • DJ_Jamba Profile Picture
    2,837 Moderator on at

    No that is the correct colour based on the condition:

    DateDiff(Today(), DataCardValue14.SelectedDate,TimeUnit.Months) >= 1, Color.Orange

    Anything over 1 month will result in Orange as per your condition

  • Benson23 Profile Picture
    18 on at

    Thank you . @DJ_Jamba . you are correct , I realised what id have done wrong , i needed orange to be 1 month leading up to the due date . my mistake .

    kind regards 

    benson23 

  • DJ_Jamba Profile Picture
    2,837 Moderator on at

    No probs and glad it's solved!

    d(-_-)b

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard