cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tsparkman
Helper II
Helper II

Filter Collection where Created Date is Between Two Dates

I'm hoping someone can help me. It's probably something so simple, but I've been struggling with this for a while so I figured I'd reach out for help.

 

I need to filter a collection based on a date range and count the number of rows.

 

I have a collection, called colSpendRequests, in my app that takes all items from a SharePoint list. I create the collection in the screen OnVisible property and that's working fine. I can see that there are items in my collection.

ClearCollect(colSpendRequests, 'Spend Request')

image.png

 

Next I'm trying to filter the collection based on the Created date (SharePoint native Created field) where the created date is between say 4/1/2021 and 6/30/2021 and display the number of records in a text label. This is the formula I'm using:

 

CountRows(Filter(colSpendRequests, Created >= 4/1/2021 && Created <= 6/30/2021))

 

It just keeps returning zero even though I know there are records in my SharePoint list that were created within that date range. 

 

Any help or insight is greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
shoog
Solution Specialist
Solution Specialist

Explicitly converting the text string to a date should do the trick:

Created >= DateValue("4/1/2021") && Created <= DateValue("6/30/2021")

View solution in original post

2 REPLIES 2
shoog
Solution Specialist
Solution Specialist

Explicitly converting the text string to a date should do the trick:

Created >= DateValue("4/1/2021") && Created <= DateValue("6/30/2021")

View solution in original post

Hi @shoog - Thank you so much for your quick reply! I had tried converting using DateValue() and I had tried using quotes around the date, but not the combination of both together. That did the trick.

 

Appreciate your help!

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,289)