cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alan1
Regular Visitor

Calendar change color a month out and then when it is over due

Hello,

I have created an app to monitor when servicing is required for our fleet.

I would like each date category to change to orange when it is a month away from expiring and red if it has expired.

Can someone please help

Alan1_0-1643435804860.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Mister_Shaik
Super User
Super User

Hi @Alan1 ,

 

I'm assuming that you want to change the background color or fill, based on the date difference of today vs the due date. Then you can use this below expression in the background color or fill property,

 

If(DateDiff(Today(), DueDateControl.SelectedDate,Days) <= 0, Red, If(DateDiff(Today(), DueDateControl.SelectedDate,Days) < 30, Orange, RGBA(56, 96, 178, 1)))

 

You can change the "DueDateControl" to the date control name, whose date you want to compare with. 

 

What the above expression basically does is

  1. It'll first check if the date difference between due data and today is less than 0, if yes, it'll change color to Red
  2. If date difference is greater than 0 but less than 30, then it'll change it to Orange
  3. Else, it'll give the default blue background

 

Hope you find this helpful! 

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Mister_Shaik
Super User
Super User

Hi @Alan1 ,

 

For the KMs left, you can use below expression for the fill property, (obviously you need to replace the KMSLeft with the data control name in your form)

If(Value(KMSLeft.Text) < 0, Red, If(Value(KMSLeft.Text) < 500, Orange, White))

It's basically checking the KMS left and setting it to Red if less than 0, else setting to Orange if less than 500 and if it's greater than 500 it's setting that to White.

 

For changing the format of your date control, you can simply do it using it's the "Format" property,
1. format.PNG

 

Hope this helps 🙂

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Mister_Shaik
Super User
Super User

Hi @Alan1 ,

 

I'm assuming that you want to change the background color or fill, based on the date difference of today vs the due date. Then you can use this below expression in the background color or fill property,

 

If(DateDiff(Today(), DueDateControl.SelectedDate,Days) <= 0, Red, If(DateDiff(Today(), DueDateControl.SelectedDate,Days) < 30, Orange, RGBA(56, 96, 178, 1)))

 

You can change the "DueDateControl" to the date control name, whose date you want to compare with. 

 

What the above expression basically does is

  1. It'll first check if the date difference between due data and today is less than 0, if yes, it'll change color to Red
  2. If date difference is greater than 0 but less than 30, then it'll change it to Orange
  3. Else, it'll give the default blue background

 

Hope you find this helpful! 

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hello,

Can you please provide the code so that the fill for the KMs left field will automatically go orange for less than 500 and red when less than zero

Thanks


Alan

 

Alan1_0-1644716099662.png

 

Alan1
Regular Visitor

Sorry one more thing, how do i change the date so that it goes day/ month/ year and not Month/day/ year

 

Thanks in advance

Alan

 

Mister_Shaik
Super User
Super User

Hi @Alan1 ,

 

For the KMs left, you can use below expression for the fill property, (obviously you need to replace the KMSLeft with the data control name in your form)

If(Value(KMSLeft.Text) < 0, Red, If(Value(KMSLeft.Text) < 500, Orange, White))

It's basically checking the KMS left and setting it to Red if less than 0, else setting to Orange if less than 500 and if it's greater than 500 it's setting that to White.

 

For changing the format of your date control, you can simply do it using it's the "Format" property,
1. format.PNG

 

Hope this helps 🙂

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,959)