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 / Filtering and sorting ...
Power Apps
Unanswered

Filtering and sorting gallery items on large dataset

(0) ShareShare
ReportReport
Posted on by 28

Hello PowerApp community, 

 

Hoping someone can give me some direction. For some context I have data containing employee name, location, observation date,  and observer name. This dataset has almost 14K rows with data from the past 2-3 years. The app is to record employee's tasks and there can be multiple entries for each employee name over the years. Since that is a lot of data to scroll through we want users to Filter and sort based on these conditions from a popup window within the screen:

1. if they select employee name but not location. Filter & Sort (with most recent on top) gallery with all the data regarding that employee name

2. if they select location, but not employee name. Filter & Sort (with most recent on top) gallery with all the data for that location.

3. if neither are selected just sort the gallery with all the data with the most recent entries at the top of the screen. 

 

I created this app in my test environment that points to a SharePoint list of my own. When I moved this app an connected it to another SharePoint site (used by the business team) my code broke. I've created and re-created this list several times!!! I think something is askew with the site itself it breaks my code every time. I was using Observation_date26 since I wanted to sort and filter based on date. But that kept breaking, so I switched to "ID" from the SharePoint list. I can only sort my gallery view on ID but the filtering will not work. 

 

Code: 
If(Not(IsBlank(ComboBox_Employee.Selected.Result)&&IsBlank(ComboBox_Location.Selected.Result)),Sort(Filter(NewObservationsDATA,Employee_Name=ComboBox_Employee.Selected.Result),ID,Descending),IsBlank(ComboBox_Employee.Selected.Result)&&Not(IsBlank(ComboBox_Location.Selected.Result)),Sort((Filter(NewObservationsDATA,Location=ComboBox_Location.Selected.Result)),ID,Descending),Not(IsBlank(ComboBox_Location.Selected.Result))&&Not(IsBlank(ComboBox_Employee.Selected.Result)),Sort(Filter(NewObservationsDATA,Location=ComboBox_Location.Selected.Result,Employee_Name=ComboBox_Employee.Selected.Result),ID,Descending),Sort(NewObservationsDATA,ID,Descending))

 

I need to ideally filter and sort through all the data but if not I can restrict the data to everything from the start of 01/01/2022. 

 

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @ZeeCCBL2022 

     

     

    With({cbe:ComboBox_Employee.Selected.Result,
     cbl: ComboBox_Location.Selected.Result,
     nod:Sort(NewObservationsDATA, ID, Descending)
     },
     With({cond1:!IsBlank(cbe)&&IsBlank(cbl),
     cond2:IsBlank(cbe)&&!IsBlank(cbl),
     cond3:!IsBlank(cbe)&&!IsBlank(cbl)
     },
     If(cond1,Filter(nod,Employee_Name=cbe),
     cond2,Filter(nod,Location=cbl),
     cond3,Filter(nod,Location=cbl && Employee_Name=cbe),
     nod
     )
     ) 
    )

     

    This should work on all 14k records.

     

  • ZeeCCBL2022 Profile Picture
    28 on at

    Hi @Drrickryp I'll give this a try today and let you know 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard