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 / DateAdd Filter not wor...
Power Apps
Answered

DateAdd Filter not working as expected on a SharePoint Event List

(0) ShareShare
ReportReport
Posted on by 33

I have an event list in SP that I am trying to have filtered out for only 30 days out from todays date. Formula seems to check out but the results aren't getting filtered the way I'm expecting them to. I'm still getting results from way past the 30 day date range. 

 

Here's my code. 

 

 

 

Filter('Training Dates', 'EventDate' >= DateAdd(Today(),30,Days))

 

 

 

 

YukonJoe_0-1658513457576.png

 

Still learning my way through all this so any help is appreciated.

 

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @YukonJoe 

    Your formula does not specify an end of your range.  So, anything past 30 days will be shown.

     

    Please consider changing your Formula to the following:

    Filter('Training Dates', 
     EventDate >= Today() && 
     EventDate <= DateAdd(Today(),30,Days)
    )

    This will return anything from today's date and 30 days out.

     

    I hope this is helpful for you.

  • YukonJoe Profile Picture
    33 on at

    That was incredibly helpful. I wasn't understanding how the 30 days part was working i thought the 30 days meant only look at 30 days out from the Today call. I was able to add that to my ClearCollect and am getting the correct data into my collection now! I owe you a drink. 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @YukonJoe 

    Yep, that is all it takes.  You can use that formula as-is on the Items property of your gallery as well - unless there is some need to duplicate all your data in-memory in a collection.

     

    Glad it was helpful!

  • YukonJoe Profile Picture
    33 on at

    Well the end goal was to filter dates for specific classes in a ComboBox, so for me it was easier to just get a collection of the dates for that range rather than filter my final results, which already has a couple filters and as you can see I'm not so good at those lol.

     

    The filter on my drop down if you're curios, there are three of those for each class.

     

    If(
     DataCardValue7.Selected.Value = "Front Desk Systems Training",
     Sort(
     Filter(
     trDates,
     Title = "Front Desk Systems Training"
     ).EventDate,
     EventDate,
     Ascending
     ),

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @YukonJoe 

    Yeah, you might want to clean those up a bit.  General rule of thumb is to *never* use If statements in your Items properties.  It should be a function that is going to return the table of items you want...normally the Filter (embed your logic in the criteria of the Filter, not outside of the Filter).  This just makes it easier to maintain, troubleshoot, and causes less issues with the app in general.

    Keep at it...you'll get there!  Just keep things in PowerApps super simple! 😁 If you find something is taking a lot of formulas and actions to do, then you are going the wrong way - pull back, think it over, and if stumped, post on the forum! 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @YukonJoe 

    Yeah, you might want to clean those up a bit.  General rule of thumb is to *never* use If statements in your Items properties.  It should be a function that is going to return the table of items you want...normally the Filter (embed your logic in the criteria of the Filter, not outside of the Filter).  This just makes it easier to maintain, troubleshoot, and causes less issues with the app in general.

    Keep at it...you'll get there!  Just keep things in PowerApps super simple! 😁 If you find something is taking a lot of formulas and actions to do, then you are going the wrong way - pull back, think it over, and if stumped, post on the forum! 

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 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard