web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error: IF statement fo...
Power Apps
Unanswered

Error: IF statement for comparing Today's date with 'Greater than' and 'Less than' - Power Apps

(1) ShareShare
ReportReport
Posted on by 76
Hi all,
 
I need to find a solution for Power Apps to make different decisions/actions dependent on Today's date.
 
Eg:
If it's between dd/mm/yyyy and dd/mm/yyyy, do THIS,
If it's between dd/mm/yyyy and dd/mm/yyyy, do THIS2,
If it's between dd/mm/yyyy and dd/mm/yyyy, do THIS3,
 
I tried using the 'Greater than' and 'Less than' symbols, but it's not adding up properly and hoping someone can find out why or offer another solution.
 
The statements used so far have been:
 
If((18/01/2025)<((DateValue(Today()), "Yes", "No") 
(Works: Prints "Yes")
 
If((DateValue(Today()))<(25/01/2025),"Yes","No")
(Wrong: Prints "No")
 
I think this is also having an effect on other formulas that include it, as I also tried the combined formula:
 
 
If((18/01/2025)<(DateValue(Today()))<(25/01/2025),"Yes","No"))
 
and that doesn't work either.
(Comes out as an error, but the date is 20/01/2025, which is after 18/01/2025 and before 25/01/2025)

 
I even replaced the formulas with basic numbers to make sure I hadn't just muddled up the symbols or anything: It didn't help. The formulas worked fine with numbers, but not with dates.
 
Am I missing something?
Categories:
I have the same question (0)
  • Verified answer
    Ytalo Silva Profile Picture
    181 Super User 2025 Season 2 on at

    Hello, I see that you are trying to use dates to make certain decisions. However, you are using (18/01/2025) instead of DateValue("18/01/2025"). When we use only (18/01/2025), the compiler assumes we are trying to divide the numbers 18, 01, and 2025.

    To compare dates, both values need to be in date format, and there are two easy ways to achieve this:

    1. The first would be to place 18/01/2025 inside a variable and then compare it with Today().
    2. The second would be to place 18/01/2025 as text inside DateValue.

    Here’s a possible solution:

    1.

    2.

     

    I hope this was helpful.😀

  • WarrenBelz Profile Picture
    153,049 Most Valuable Professional on at
    Another suggestion here if you are hard-coding dates
    If(
       Date(2025,1,18) < Today(),
       "Yes", 
       "No"
    ) 
     
  • CU09091727-0 Profile Picture
    76 on at
     
    Perfect response!
     
    Thank you so much. This is exactly what I was looking for.
     
    I knew it was something so simple, but couldn't the errors in my coding or 'see the wood for the trees' (as they say)!
     
    I added in the DateValue(" ") adjustments as described and it's now working exactly as I hoped.
     
    Now I can start adding all of the more complex actions that are dependent on these condition statements. Cheers. :)
     
     
     
    How do I confirm your response as the answer? It's only showing a tick box but no button to save/accept/confirm. It also won't let me respond directly to other people's comments/suggestions, which is odd. Only changed recently, so I wonder if it's an update to the site.
     
     
  • Ytalo Silva Profile Picture
    181 Super User 2025 Season 2 on at
    I believe that to confirm, you should validate my suggestion, haha! Thank you for the feedback. I'm happy to help.😀
  • Ytalo Silva Profile Picture
    181 Super User 2025 Season 2 on at
     
    Hello, could you validate my suggestion if it works so I can mark the post as answered? I would be extremely grateful.😀

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard