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 / ForAll and Multil leve...
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

    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

    Spot on thank you 🙂

  • LaurensM Profile Picture
    12,516 Moderator on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard