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 / Problem with the Today...
Power Apps
Unanswered

Problem with the Today() function in a Filter expression

(0) ShareShare
ReportReport
Posted on by 55
Building a canvas app, with Dynamics 365 (Dataverse) as my source. In my gallery on the main page, I added a search requirement :
 'Start Date' < Today()  
 'Start Date' < Today()  
Both of those seem to work fine; I get the results I expected.  The first one gives past Start Date entries and the second one gives future Start Date entries.
 
But what I really want is to do a search where the Start Date field is specifically greater than 30 days ago, so I entered 
'Start Date' > Today() - 30
This should give me results where Start Date is later than 30 days ago, on up to the present and future dates as well.  This does not work at all.
If this helps, both the ">" and the "-" symbols have a red squiggly line under them indicating there is something wrong; the squiggle is not under the "<" or ">" in those original statements above.  The squiggle only appears when I use the "-30" part of the expression.
 
Even more oddly, when I add an upper limit:
'Start Date' < Today() + 30
the squiggles do NOT appear in the second phrase, no matter which order I put them in.  So whether I enter one or the other below...
 'Start Date' < Today() + 30, 'Start Date' > Today() 30
 'Start Date' > Today() 30, 'Start Date' < Today() + 30
 
...in both those lines, the first expression has the squiggles and the second expression does not.
And in both cases, I get no results at all.
 
If it helps to see the entire line, here it is, placed into the "Items" field for the gallery:
Filter('House Events', SearchInputBox.Text in 'Event Description', 'Start Date' > Today()-30, 'Start Date' < Today() + 30)
 
I would really appreciate any suggestion you may have.  
 
As with many things regarding computers, the answer is easy, but not remotely intuitive.
 
 
Categories:
I have the same question (0)
  • Verified answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    You need to use the DataAdd() function to get past or future times.
     
    //future
    DateAdd
    (Today(),30,TimeUnit.Days)
     
    //past
    DateAdd(Today(),-30,TimeUnit.Days)
    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |

     
  • WillBeeSea Profile Picture
    55 on at
    Thank you Mark Nanneman! 
    That is exactly what I needed.  I had tried DateAdd() before, but I messed up the syntax.

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