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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,768)