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 / Implementing grouping ...
Power Apps
Suggested Answer

Implementing grouping with sorting functionality in powerapps

(1) ShareShare
ReportReport
Posted on by 2
I m planning to implement grouping in a table gallery based on a column and then have sorting and filtering feature in the gallery. I had a look at one of the video of Reza - Group By in Power Apps Gallery with Large SharePoint Lists where he has implemented filtering in a nested gallery. However, we plan to implement a sorting feature (refer the up down arrow in image below) also along with the filtering, something like below –



Can anyone pls confirm if it is feasible to have sorting along with filtering in a nested gallery and has implemented similar to this in the past. Pls share with us if its possible. It will be a great help.
 
Thanks
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,653 on at
     
    Could you pleae elaborate a bit? Can you please mention based on which column you want to make grouping? As I see in the attached screenshot - you want to filter with the option "All projects" - a toggle and then sort any column on the table or any specifica column? If that is the case how do you want "All Projects" toggle? If it is on, the filter wills how all projects, if it is off then what?
     
    Let's say we want  grouping based on Project Name and then filter with the toggle All projeccts and sorting based on ID?
     
     
    To me Power Apps does not have a built-in grouped gallery control, but you can simulate grouping by using a nested gallery or by preparing your data with GroupBy.
     

    Let's consider = your data source is MyData with columns ProjectName, ID, and others.

    1. Use GroupBy to group items by ProjectName: You can do this at initiation of screen like screen's OnVisible event.

    ClearCollect(
        colGroupedProjects,
        GroupBy(
            MyData,
            "ProjectName",
            "ProjectItems"
        )
    )
    
     
    Trick you need to do is set your outer gallery's Items property to colGroupedProjects. Then, inside the outer gallery, add a nested gallery whose Items property is ThisItem.ProjectItems to show the grouped records.
     
     

    I am considering you have a toggle control named tglAllProjects:

    • If tglAllProjects is On, show all projects.
    • If Off, filter by a selected project (e.g., from a dropdown ddProject - you have project list in the dropdown).

    You can incorporate filtering before grouping like this:

    ClearCollect(
        colGroupedProjects,
        GroupBy(
            If(
                tglAllProjects.Value,
                MyData,
                Filter(MyData, ProjectName = ddProject.Selected.Result)
            ),
            "ProjectName",
            "ProjectItems"
        )
    )
    

    Finally, we can sort the grouped items inside each group by the ID column. In the nested gallery inside the outer gallery, set the Items property to:

    Sort(ThisItem.ProjectItems, ID, Ascending)
    
    Please note that, I just assumed the this way - please let me know this is way you want.
     
    References: 
    1. Sort the combined collection into groups.
    2. Sort, and filter data in a canvas app gallery
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard