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 Apps
Answered

Date filtering

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

Date filtering is hurting my brain.

I'm trying to show only events with an event date within the last two weeks and include events happening today.

I tried this, but it's only including the events from the last 14 todays but not including today's events. 

ShowColumns(Filter(Events,Event_x0020_Date>= DateAdd(Today(),-14),Event_x0020_Date<=Today()), "City", "Title")

Ideas? Thx!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @russrimm 

    Your problem is that your Date really includes a time as well.  So, when you are saying Event_x0020_Date<=Today() here is how it really turns out (let's assume today's date):

         5/10/2019 00:00  <= 5/10/2019 00:00

    All seems like it should work...right?

     

    Well, enter the real problem, you need to adjust for timezone.  Chances are, your date for event date is really in the system as 5/10/2019 04:00 (or some other hour depending on your timezone).  Well, that will never meet the criteria for <=.

    So, you could try a couple of things:

    1) Test this theory - change your formula to this:

    ShowColumns(
    Filter(Events,
    Event_x0020_Date >= DateAdd(Today(),-14) &&
    Event_x0020_Date <= DateAdd(Today(), 1439, Minutes)
    ),
    "City", "Title"
    )

    This will add 24:59 minutes to Today's date...still today, but end of day. 

     

    2) Adjust for TimeZone.  Change your Formula to this:

    ShowColumns(
    Filter(Events,
    DateAdd(Event_x0020_Date, -TimeZoneOffset(Event_x0020_Date), Minutes) >= DateAdd(Today(),-14) &&
    DateAdd(Event_x0020_Date, -TimeZoneOffset(Event_x0020_Date), Minutes) <=Today()
    ),
    "City", "Title"
    )

    This will adjust the time zone of the dates to be correct.  Then 00:00 should be 00:00

     

     

    I hope this is helpful for you.

       

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard