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 / Switch function doesnt...
Power Apps
Answered

Switch function doesnt work with Today()

(1) ShareShare
ReportReport
Posted on by 33

Hi,

I will have a circle who is red or green or blue depending on the date. When I do an IF condition it works with <=Today() but in the switch condition it doesn't what do i do wrong here. This is my code:

Switch(ThisItem.Engin_date_fait; <= Today() +180 ; Red; = Today(); Green; <=Today() -10; Blue)

 

<=Today() is always red underlined ?

 

Thanks

Categories:
I have the same question (0)
  • Cvetkovski7 Profile Picture
    30 on at

    "$" & If(
    DatePicker1.SelectedDate = Today(),"3",
    DatePicker1.SelectedDate = Today()+15,"5",
    DatePicker1.SelectedDate = Today()+15,"32",
    DatePicker1.SelectedDate = Today()+15,"123"
    )

     

    This is for Text,implement this in Color and change mu "number" with color name without ""

  • wuffwuff2003 Profile Picture
    33 on at

    Hello,

    I don't have date picker, i compare the TODAY() Date with a table element in sharepoint.

    Thanks

  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Switch functions are for matching exact values, not for covering if something is within a range,

     

    You can use the following:

     

    If(
     ThisItem.Engin_date_fait <= (Today() +180) ; Red; 
     ThisItem.Engin_date_fait = Today(); Green; 
     ThisItem.Engin_date_fait <= (Today() -10); Blue
    )
  • wuffwuff2003 Profile Picture
    33 on at

    Ok thats the point, thanks that it is just matched values and not in ranges. Many thanks

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard