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

Group By and date

(0) ShareShare
ReportReport
Posted on by 40

Collect(employees;
{ ID: 1; Name: "John Doe"; Date: "01/10/2023" };
{ ID: 1; Name: "Jane Doe"; Date: "02/10/2023" };
{ ID: 2; Name: "Jhon Doe"; Date: "03/10/2023" };
{ ID: 2; Name: "Mary Doe"; Date: "04/10/2023" }
)

 

Output
ID: 1; Name: "Jane Doe"; Date: "02/10/2023"
ID: 4; Name: "Mary Doe"; Date: "04/10/2023"

Categories:
  • Pro_User_365 Profile Picture
    546 on at

    Hi @Majid2024 ,

    Please provide complete information about this!

     

  • Majid2024 Profile Picture
    40 on at

    I want to group this collection and get the largest date

  • Verified answer
    SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @Majid2024 

     

    Recreating the case as followed:

     

    Create the collection

    ClearCollect(
     employees,
     { ID: 1, Name: "John Doe", Date: DateValue("01/10/2023") },
     { ID: 1, Name: "Jane Doe", Date: DateValue("02/10/2023") },
     { ID: 2, Name: "Jhon Doe", Date: DateValue("03/10/2023") },
     { ID: 2, Name: "Mary Doe", Date: DateValue("04/10/2023") }
    );

     

    Group the employee based on the ID in another collection groupedEmployees:

    ClearCollect(
     groupedEmployees, 
     GroupBy(
     SortByColumns(
     employees, 
     "ID", 
     SortOrder.Ascending, 
     "Date", 
     SortOrder.Descending
     ), 
     "ID", 
     "group"
     )
    );

     

    From each group ID member you get the latest record:

    ForAll(
     groupedEmployees, 
     Collect(
     resultFinal, 
     {
     ID: ID, 
     Name: First(group).Name, 
     Date: Text(First(group).Date, "dd/mm/yyyy")
     }
     )
    );

     

    SpongYe_0-1701204249645.png

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard