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

Announcements

News and Announcements icon
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
    155,955 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 294 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 169

Last 30 days Overall leaderboard