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 Apps
Answered

Sorting issue

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

HI 

 

I have this query 

 

LastN(Filter('Incident Log',spgCaseID = displayItem.ID),5)

 

that pulls 5 last records of a SP list. I need to just add sorting to it so that it sorts it decending order. Where do i add that in the query please?

 

Thank you

 

Categories:
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi JoelHj 

    Try this:

     

    SortByColumns(
    LastN(Filter('Incident Log',spgCaseID = displayItem.ID),5),
    "spgCaseID", // Use name of column you want to sort by //
    Descending)

    Sorting documentation: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Perfect that worked. I just seem to get the comma and things in the wrong places. 

     

    Thank you very much

     

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 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard