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

Filter Gallery By Year

Hello,

 

I have an application that is using a SharePoint list to collect data. I am trying to filter the gallery by year by using a dropdown. The data for the dropdown is coming from a Date and Time column in SharePoint that holds a full date i.e.:) 9/8/2021. I only want the dropdown to show the Years available from the Date and Time field in SharePoint.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
gazzo1967
Impactful Individual
Impactful Individual

@cperry07 
hi 

On your dropdown you need to use the following
Distinct(yoursharepointname,Year(datetime field name))
but i would suggest that you dont directly filter you sharepointlist as you will run into delegation issues asafter 2000 rows of data.

To avoid this

Select your screen

gazzo1967_0-1631132787580.png

then 
Change to 

gazzo1967_1-1631132839257.png

 in the formula 'bar' add the following
ClearCollect(ColYear, yoursharepointlistname)

Go back to you screen that your are filtering on and on the dropdown item change the formula to
Distinct(ColYear,Year(datetime field name))
this will avoid delegation issues

Hope that helps
gary
PS if it solves your issue please consider Thumbs up and mark as accept solution thanks 🙂

View solution in original post

11 REPLIES 11
gazzo1967
Impactful Individual
Impactful Individual

@cperry07 
hi 

On your dropdown you need to use the following
Distinct(yoursharepointname,Year(datetime field name))
but i would suggest that you dont directly filter you sharepointlist as you will run into delegation issues asafter 2000 rows of data.

To avoid this

Select your screen

gazzo1967_0-1631132787580.png

then 
Change to 

gazzo1967_1-1631132839257.png

 in the formula 'bar' add the following
ClearCollect(ColYear, yoursharepointlistname)

Go back to you screen that your are filtering on and on the dropdown item change the formula to
Distinct(ColYear,Year(datetime field name))
this will avoid delegation issues

Hope that helps
gary
PS if it solves your issue please consider Thumbs up and mark as accept solution thanks 🙂

cperry07_0-1631136653427.png

cperry07_1-1631136681356.png

Hey Gary,

 

Thanks for your response.

 

The items in the dropdown are blank, am I missing something?

 

Chris

@gazzo1967 ah, it started working randomly, thank you!

gazzo1967
Impactful Individual
Impactful Individual

@cperry07 
FYI
when you use ONVISIBLE at screen level to 'grab' a collection you need to navigate away and comeback for it to work as you have to actually trigger the formula because the screen is already  visible 🙂

Gary

@gazzo1967 

 

Hey Gary,

 

Had a follow up question. I am trying using a collection to use buttons and dropdowns to filter my gallery. I have buttons for "All" / "Pending" / "In Progress" / "Complete", I also have a dropdown where users can select an "Incident Name" then a button to apply that dropdown. I have now added the year dropdown and am trying to have the "Apply" button apply if there is a selection from the year dropdown. They are using a collection with the name ToggleCol2. I tried using an Or statement, but maybe i'm doing it incorrectly.

 

cperry07_0-1631221191811.png

 

 

 

gazzo1967
Impactful Individual
Impactful Individual

@cperry07 
im lost lol
Could you detail it a little clearer as in what a user would do?

Gary

gazzo1967
Impactful Individual
Impactful Individual

@cperry07 
are you trying to apply a multiple filter on your collection?

 

cperry07
Helper II
Helper II

@gazzo1967 

 

Sorry I butchered my above post LOL. That's what I get for multi-tasking. Yes, I would like to filter the gallery where a user could select a button or a dropdown.

gazzo1967
Impactful Individual
Impactful Individual

@cperry07 

so what are your buttons/dropdowns you want to filter on called (what did you name each of them)
is this how you want it to work
User Selects
one of these buttons - "All" / "Pending" / "In Progress" / "Complete"
Then selects - "Incident Name"
Then Selects Year dropdown
then selects apply button

is that right?
gary

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,147)