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")
}
)
);

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! 🍻