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 / how do i Sort, filter ...
Power Apps
Answered

how do i Sort, filter and pagination for a gallery in power apps

(0) ShareShare
ReportReport
Posted on by 43

Hi

I have gallery contains so many records, now I want sort, filter(Choice type and Date type columns)  and pagination for a gallery. so that anyone can use the app  very flexible.

 

Here I am using data source as Dataverse.

 

Please help me out how to achieve this one.

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @satishkumark ,

     

    I assume:

    1. I have a table has 3 columns. ('Name' -> Text column . 'TestChoice' -> Choice Column . 'TestDate' -> Date Column)
    2. Sort by 'Name' column. (Ascending)
    3. Filter by 'TestChoice' Column and 'TestDate' column.
    4. Pagination. Display up to 2 items per page.

    I did a test for you.

    1\ This is my table.

    v-xiaochen-msft_0-1621565174043.png

     

    2\ Set the screen's OnVisible property to:

    Set(A,SortByColumns(Filter(TestNews,TestChoice=ComboBox1.Selected.Value,TestDate>=DatePicker1.SelectedDate,TestDate<=DatePicker2.SelectedDate),"crba2_name",Ascending));Set(Thevar,1)

     

    3\ Add a combo box control 'ComboBox1' and set its Items property to:

    Choices(TestNews.TestChoice)

     

    Set its Onchange property to:

    Set(A,SortByColumns(Filter(TestNews,TestChoice=ComboBox1.Selected.Value,TestDate>=DatePicker1.SelectedDate,TestDate<=DatePicker2.SelectedDate),"crba2_name",Ascending));Set(Thevar,1)

     

    4\ Add a DatePicker control 'DatePicker1' and set its OnChange property to:

    Set(A,SortByColumns(Filter(TestNews,TestChoice=ComboBox1.Selected.Value,TestDate>=DatePicker1.SelectedDate,TestDate<=DatePicker2.SelectedDate),"crba2_name",Ascending));Set(Thevar,1)​

     

    5\ Add a DatePicker control 'DatePicker2' and set its OnChange property to:

    Set(A,SortByColumns(Filter(TestNews,TestChoice=ComboBox1.Selected.Value,TestDate>=DatePicker1.SelectedDate,TestDate<=DatePicker2.SelectedDate),"crba2_name",Ascending));Set(Thevar,1)​

     

    6\ Add an icon and set its onselect property to:

    If(Thevar<>1,Set(Thevar,Thevar-1))

     

    7\ Add an icon and set its onselect property to:

    If(Thevar<RoundUp(CountRows(A)/2,0),Set(Thevar,Thevar+1))

     

    8\ Add a gallery control and set its Items property to:

    If(Thevar<RoundUp(CountRows(A)/2,0),LastN(FirstN(A,Thevar*2),2),LastN(A,CountRows(A)-2*(Thevar-1)))

     

    9 The result is as follows:
    AAA.gif

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard