web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Gallery Fil...
Power Apps
Suggested Answer

Power Apps Gallery Filtering Issue with Year

(1) ShareShare
ReportReport
Posted on by 8
I want to filter a gallery based on year values from a SharePoint list. The SharePoint list has a calculated column called ProjectStart_Year that extracts and stores the year as a Date/Time (e.g., "2023"). I want to allow users to filter the gallery using a search bar (which already works as my code shows) and the year using a dropdown.
 
I intend to use a dropdown to show the distinct years which the gallery should filter by

Code:
If(
    IsBlank(SearchBar.Text),
    'Data Source',  
    Filter('Data Source', StartsWith(Title, SearchBar.Text))
)
It's kind of tricky because I think the SP list column contains date and time by default and PowerApps can match the date when looking up a record but not a time.
If somebody could help me with the coding of the Gallery items property code I would appreciate it.
 
Also, off topic question, For some reason, The forum's UI changed and I don't have the option to reply to responses. is that a bug?
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at
    Unfortunately SharePoint calculated columns, apart from not supporting Delegation, do not "play well" with Power Apps and should not be relied on for queries.
    Firstly, set the Default of SearchBar to "" (empty string) and then using your reference date and the field in the list that the calculated column references.
    With(
       {
          _Start: Date(Year(YourReferenceDate), 1, 1),
          _End: Date(Year(YourReferenceDate), 12, 31)
       },
       Filter(
          'Data Source', 
          StartsWith(
             Title, 
             SearchBar.Text
          ) &&
          YourDateField >=_Start && YourDateField <= _End
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard