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 label colour ba...
Power Apps
Answered

Change label colour based on date value

(0) ShareShare
ReportReport
Posted on by 580

Hi All, 

 

I would like to change a label colour based on a date value, could anyone guide me please?

 

As an example, a member of staff has a review booked for the 20/1/22

20 Days & Over the date above, the label wants to be green.

Less than 20 days to go from the above date, the label wants to change orange

On the 20/1/22 and beyond, the label wants to turn red. 

 

I was experimenting with DateDiff but couldn't get it right. 

 

However If we have marked the review as being complete "Yes" then the label wants to turn to light green.
The Yes/No is a choice field. 

2022-01-17 23_36_35-Window.png

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @AdamH ,

    Something like this

    With(
     {
     wDays:
     DateDiff(
     Today(),
     ReviewDateField,
     Days
     )
     },
     If(
     ReviewCompletedField = "Yes"
     LightGreen,
     wDays >= 20,
     Green,
     wDays >= 0,
     Orange,
     Red
     )
    )
    

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • AdamH Profile Picture
    580 on at

    Hi @WarrenBelz 

     

    I tried that but came up against some errors. 

    2022-01-17 23_58_03-Window.png

  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @AdamH ,

    That is because it is a yes/no field - I actually had a debate with myself whether to post the below first, but you described the input as "Yes", which infers Text. You are also missing a comma at the top.

    With(
     {
     wDays:
     DateDiff(
     Today(),
     '6 Month NQP Review Date',
     Days
     )
     },
     If(
     ThisItem.'6 Month NQP Review Completed',
     LightGreen,
     wDays >= 20,
     Green,
     wDays >= 0,
     Orange,
     Red
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • Toby124 Profile Picture
    29 Power Up Champ - 2025 on at

    @AdamH , the code posted by @WarrenBelz  is correct. You are supposed to use a date-time value

    Screenshot (257).png
  • AdamH Profile Picture
    580 on at

    @WarrenBelz 

    Thanks for that guide. I modified a little by placing .Value="Yes"

     

    With(
     {
     wDays:
     DateDiff(
     Today(),
     ThisItem.'6 Month NQP Review Date',
     Days
     )
     },
     If(
     ThisItem.'6 Month NQP Review Completed?'.Value="Yes",
     LightGreen,
     wDays >= 20,
     Green,
     wDays >= 0,
     Orange,
     Red
     )
    )
  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @AdamH ,

    So it was a Choice column - I actually see that now right at the bottom of your post.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard