cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Sorting issue

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanielaH
Level 8

Re: Sorting issue

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

 

View solution in original post

2 REPLIES 2
DanielaH
Level 8

Re: Sorting issue

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

 

View solution in original post

Anonymous
Not applicable

Re: Sorting issue

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

 

Thank you very much

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,807)