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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / fill color according t...
Power Apps
Unanswered

fill color according to certain date

(0) ShareShare
ReportReport
Posted on by

Dear expert,

 

I would like to fill my Button with colors based on the dates.

 

Basically, i do have a column in my sharepoint with "Expected Completion Date" - which dates looks like 2/11/2022 (MM/DD/YYYY).

 

So " Expected Completion Date" is due compare to today date, then should be Red color,

If "Expected Completion Date"  is going to be due next 7 days, then should be Orange.

 

Else shall be white.

 

Any idea, It would be nice if could calculate days that due.

 

Thanks

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

    Hi @PRABA7385 ,

    Put this on the Color of the button - assuming it is in the same form or gallery as the field

    With(
     {
     wDays:
     DateDiff(
     Today(),
     ThisItem.'Expected Completion Date',
     Days
     )
     },
     If(
     wDays < 1,
     Red,
     wDays < 8,
     Orange,
     White
     )
    )

     

    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

     

  • PRABA7385 Profile Picture
    on at

    Dear Sir,

     

    The provided solution absolutely works. Thanks. I forgot mention something. Some of my list is already Closed.

     

    My sharepoint have another column which is Project Status contains Closed, Work In progress, Open. How could i change the colour above button for Closed list/items. Now we use same button but if the project already closed according to Project Status then should be Green.

     

    Thanks

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @PRABA7385 ,

    Something like this

    With(
     {
     wDays:
     DateDiff(
     Today(),
     ThisItem.'Expected Completion Date',
     Days
     )
     },
     If(
     ThisItem.'Project Status' = "Closed",
     Green,
     wDays < 1,
     Red,
     wDays < 8,
     Orange,
     White
     )
    )

     

    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

  • PRABA7385 Profile Picture
    on at

    Dear Sir,

     

    I did use the same command but there is an error. I use the script on rectangular & fill property instead button .

     

    PRABA7385_0-1644330969330.png

     

    Thanks

     

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @PRABA7385 ,

    If this is a Choice column, you need ThisItem.'Project Status'.Value

     

    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard