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 / conditional alert depe...
Power Apps
Answered

conditional alert depending the date

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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.

Categories:
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    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.
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    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,

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard