Category: Data | Works in: Canvas Apps
First returns the first record from a table; Last returns the final record. Commonly used after Filter or Sort to retrieve one specific row.
First( Table )
Last( Table )
First(Products)
First(Sort(Filter(Orders, CustomerEmail = User().Email), OrderDate, SortOrder.Descending))
First(Sort(Filter(Tasks, Status = "Open"), DueDate, SortOrder.Ascending))
If(
!IsEmpty(varSearchResults),
Set(varTopResult, First(varSearchResults)),
Notify("No results.", NotificationType.Warning)
)
With(
{ sorted: Sort(varData, Date, SortOrder.Ascending) },
Text(First(sorted).Date, "dd MMM") & " – " & Text(Last(sorted).Date, "dd MMM yyyy")
)
Set(varNewRec, Patch(Events, Defaults(Events), { Title: txtTitle.Text, CreatedOn: Now() }));
// varNewRec IS the new record — equivalent to First(Sort(Events,CreatedOn,SortOrder.Descending))
- Validate inputs before using in write operations.
- Combine with related functions for complete workflows.
- Test with both empty and populated data sources.
- Consider delegation when working with large data sets.
| Function | Relationship |
|---|---|
Filter |
Related function |
Sort |
Related function |
LookUp |
Related function |
IsEmpty |
Related function |
← Back to Home | Power Apps Formulas Reference | Last updated: May 2026