cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

conditional alert depending the date

Hi everyone!

 

I've a question. I would like to create a conditional alert, I put a circle as my alert in my gallery and I would like to associated a "datacardvalue" this one is associeted a date.

 

My question is, how can I change the color of my circle depending which date it is. For example:

 

My "datacardvalue" is 24/04/2020 <----- (this one is my update date) so, if my "datacardvalue" its equal a "today" my circle will be green, also for 25/04/2020 and 26/04/2020, but if elapse 3 days (27/04/2020) my circle will change color to yellow and if it elapse 4 days (28/04/2020) my circle will change to red.

 

I tried with "If " but it didn't work becuase I don't know which other value i have to add.

 

I'll waiting for your comments

 

Best regards.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: conditional alert depending the date

Try:

If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=0,Green,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=1,Yellow,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=2,Yellow,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=3,Blue,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)>3,Red)))))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Highlighted
Community Support
Community Support

Re: conditional alert depending the date

Hi @diegoaff92 ,

Do you want to change circles' color based on this item's datevalue?

Like this:

4276.PNG

 If so, you just need to set the circle's Fill and compare Today with thisitem's datevalue.

Could you tell me the field's data type that records date?

I assume that it is datevalue.

I've made a similar test for your reference:

1)the gallery's Items:

[DateValue("4/24/2020"),DateValue("4/25/2020"),DateValue("4/26/2020"),DateValue("4/27/2020"),DateValue("4/28/2020")]

My date field is Value and it is date type.

2)insert a circle inside the gallery

set the circle's Fill:

If(ThisItem.Value=Today(),Green,
//value=today
DateDiff(Today(),ThisItem.Value,Days)>0&&DateDiff(Today(),ThisItem.Value,Days)<=3,Yellow,
//value>today and<=today+3
DateDiff(Today(),ThisItem.Value,Days)>=4,Red
//value>=today+4
)

The DateDiff function returns the difference between two date/time values.

Please notice the result's positive and negative.

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: conditional alert depending the date

Try:

If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=0,Green,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=1,Yellow,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=2,Yellow,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)=3,Blue,
If(DateDiff(Today(),DateValue(SearchBox.Text),Days)>3,Red)))))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Highlighted
Community Support
Community Support

Re: conditional alert depending the date

Hi @diegoaff92 ,

Do you want to change circles' color based on this item's datevalue?

Like this:

4276.PNG

 If so, you just need to set the circle's Fill and compare Today with thisitem's datevalue.

Could you tell me the field's data type that records date?

I assume that it is datevalue.

I've made a similar test for your reference:

1)the gallery's Items:

[DateValue("4/24/2020"),DateValue("4/25/2020"),DateValue("4/26/2020"),DateValue("4/27/2020"),DateValue("4/28/2020")]

My date field is Value and it is date type.

2)insert a circle inside the gallery

set the circle's Fill:

If(ThisItem.Value=Today(),Green,
//value=today
DateDiff(Today(),ThisItem.Value,Days)>0&&DateDiff(Today(),ThisItem.Value,Days)<=3,Yellow,
//value>today and<=today+3
DateDiff(Today(),ThisItem.Value,Days)>=4,Red
//value>=today+4
)

The DateDiff function returns the difference between two date/time values.

Please notice the result's positive and negative.

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,480)