cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

Filtering on date range

Hi all,

I have a dropdown that is populating events on todays date using
Filter(EventCollect,Date(Year('Event Start Date and Time'),Month('Event Start Date and Time'),Day('Event Start Date and Time'))=Today())

 

Now I want it to populate events from today and for the past 7 days.

I'm trying this, but it appears to be showing all events today backward beyond the past 7 days.  

Filter(EventCollect,Date(Year('Event Start Date and Time'),Month('Event Start Date and Time'),Day('Event Start Date and Time')) < DateAdd(Today(),-7,Days))

 

Tips?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filtering on date range

I think your inequality is the issue. You are looking for everything smaller than (i.e. earlier than) a date that is seven days before today.

You might try the following:

Filter(
    EventCollect,
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) >= DateAdd(Today(),-7,Days)
)

If there is the possiblity of dates bigger than (i.e. later than) today, you might want to add the following:

Filter(
    EventCollect,
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) >= DateAdd(Today(),-7,Days),
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) <= Today()
)

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Filtering on date range

If I read your statement correctly, you are currently telling it to subtract 7 days from today to get a new date and compare then comparing Event Start Date against that new date that is 7 days prior to today.  I think what you are really trying to do is get those  where the date is GREATER THAN OR EQUAL to 7 days ago. (or simply greater than 8 days ago).

 

I would try changing your -7 to a -8 and reversing the > to a < and see what you get.

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Highlighted
Super User
Super User

Re: Filtering on date range

I think your inequality is the issue. You are looking for everything smaller than (i.e. earlier than) a date that is seven days before today.

You might try the following:

Filter(
    EventCollect,
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) >= DateAdd(Today(),-7,Days)
)

If there is the possiblity of dates bigger than (i.e. later than) today, you might want to add the following:

Filter(
    EventCollect,
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) >= DateAdd(Today(),-7,Days),
    Date(
        Year('Event Start Date and Time'),
        Month('Event Start Date and Time'),
        Day('Event Start Date and Time')
    ) <= Today()
)

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Filtering on date range

Thank you the 2nd example you gave is exactly what I needed!!  Much appreciated.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,601)