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 / Error: IF statement fo...
Power Apps
Answered

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

(2) ShareShare
ReportReport
Posted on by 80
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?
2024-01-2025 Power Apps Date issue MAIN 2.PNG
Categories:
I have the same question (0)
  • Verified answer
    Ytalo Silva Profile Picture
    193 Moderator 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
    155,450 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
    80 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
    193 Moderator 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
    193 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 833

#2
Valantis Profile Picture

Valantis 563

#3
Haque Profile Picture

Haque 383

Last 30 days Overall leaderboard