Have you ever wanted to find the newest/latest of all the different categories in a data set? For instance the latest sale by each sales person, the last registration by a person - and generate a table of records.
Firstly, a disclaimer here as the function used is not Delegable, however if all records you are looking for are in the newest 2,000 records, then read on. I am also assuming SharePoint as a data source in the example below.
Firstly the code required
With(
{
wGroup:
AddColumns(
GroupBy(
Sort(
YourSPList,
ID,
Descending
),
"YourIdentifyField",
"OtherData"
),
"IDMatch",
First(OtherData).ID
)
},
ForAll(
wGroup,
Collect(
YourCollection,
LookUp(
YourSPList,
ID = IDMatch
)
)
)
)
To explain what is going on here: -