cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_sourcecod3_
Helper IV
Helper IV

filter gallery using string date ranges

Hi all,

 

I'm trying to filter a gallery from start date to end date (date pickers). I don't want to run into the delegation issue so i've created a 'strCreated' single line column to use instead. how can i filter the gallery using this field? This is what i have so far but nothing comes up: 

 

Filter(colItems, strCreatedDate >= dpStartDate.SelectedDate && strCreatedDate <= dpEndDate.SelectedDate)

 

Any clues what I could be missing? 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@_sourcecod3_ 

Usually PowerApps will cast the value for you, but not always, so give this a try instead:

Filter(colItems, 
    (Value(strCreatedDate) >= Value(Text(dpStartDate.SelectedDate, "yyyymmdd"))) && 
    (Value(strCreatedDate) <= Value(Text(dpEndDate.SelectedDate, "yyyymmdd")))
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@_sourcecod3_ 

What is the format of your text date you are storing?  It must be stored in the yyyymmdd format.

 

Then your formula will be:

Filter(colItems, 
    strCreatedDate >= Text(dpStartDate.SelectedDate, "yyyymmdd") && 
    strCreatedDate <= Text(dpEndDate.SelectedDate, "yyyymmdd")
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes i tried your suggestion but it looks like it's looking for a number value. This is the error i get: 

 

_sourcecod3__0-1607718182635.png

 

When i change the Text to Value instead there are no errors but nothing it being pulled in the gallery.

RandyHayes
Super User
Super User

@_sourcecod3_ 

Usually PowerApps will cast the value for you, but not always, so give this a try instead:

Filter(colItems, 
    (Value(strCreatedDate) >= Value(Text(dpStartDate.SelectedDate, "yyyymmdd"))) && 
    (Value(strCreatedDate) <= Value(Text(dpEndDate.SelectedDate, "yyyymmdd")))
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@RandyHayes This is perfect!! thank yo so much

 

@RandyHayes 

How would you apply the filter to both weekly date range and groupby items ?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,931)