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 to display the mos...
Power Apps
Answered

How to display the most recent rows in a SharePoint List in a Gallery

(0) ShareShare
ReportReport
Posted on by 782

I have an app with a Gallery and am using the following function to pull data from my SharePoint List into a Power Apps Gallery:

SortByColumns(Switch(varGalleryFilter,
1, Filter(VehicleRegistration, VehicleOnCampus="Yes" && Status="New"),
2, Filter(VehicleRegistration, VehicleOnCampus="Yes" && (Status="Rejected" Or Status="Completed")),
3, Filter(VehicleRegistration, VehicleOnCampus="Yes" && Status="New")
), "Created", SortOrder.Descending)

 

varGalleryFilter is set to 2 if the user clicks the "Archive" button. Currently, it only displays the first 500 rows in my SharePoint List. If I change the Data row limit to 2,000, I get all of my rows, but when I surpass 2,000 rows, I will run into the same problem. It was my understanding that using the "Descending sort order, I would get the most current rows, but it seems that I am getting the first 500. How can I get the most recent rows?

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Greg27,

     

    In this case you could Sort the datasource before Filtering. Currently you will sort the returned output of your Filter() function.

     

    Filter(
     Sort(
     VehicleRegistration,
     Created,
     SortOrder.Descending
     ),
     VehicleOnCampus = "Yes",
     (Status = "New" && (varGalleryFilter = 1 || varGalleryFilter = 3)) ||
     ((Status="Rejected" || Status="Completed") && varGalleryFilter = 2)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Greg27 Profile Picture
    782 on at

    @LaurensM 

    Thanks so much for your help. It worked perfectly!!

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 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard