web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

ForAll and Multil level Sort for unique items

(0) ShareShare
ReportReport
Posted on by 121

Hi i'm using the following code to get the unique records for all uses with their GRS number in date order wit the newest log entry to show.

 

ForAll(GroupBy(Command,"GRS","_items"),First(Sort(_items, 'Log Date',SortOrder.Descending)))

 

The problem is that it doesn't sort it by the most recent but the last entered.

 

How can i change this code slightly so that it will further sort it by the 'Log Date'.Descending?

 

Cheers

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at
    Re: ForAll and Multil level Sort for unique items

    Hi @Markswan20😊

     

    Currently you are grouping the datasource and only sorting the grouped sub-table. Do you want the full list to adhere to the Log Date sorting order? In this case, you will have to sort the datasource first and only then apply the GroupBy function:

     

    ForAll(
     GroupBy(
     Sort(
     Command,
     'Log Date',
     SortOrder.Descending
     ),
     "GRS",
     "_items"
     ),
     First(_items)
    )

     

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

    Thanks!

  • Markswan20 Profile Picture
    121 on at
    Re: ForAll and Multil level Sort for unique items

    Spot on thank you 🙂

  • LaurensM Profile Picture
    12,516 Moderator on at
    Re: ForAll and Multil level Sort for unique items

    Perfect, glad I was able to help! 😊

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard