I recently got a task where I needed to get the first record, the last record, the first 10, and the last 10 records in Power Apps. Fortunately, Power Apps provides some functions like First, FirstN, etc., to achieve it very easily.
In this Power Apps tutorial, I will explain everything about the First function in Power Apps, Last function in Power Apps, FirstN in Power Apps, and LastN in Power Apps with different scenarios.
Also, we will see how to work with Power Apps lookup first record and Power Apps lookup last record.
First Function in Power Apps
Power Apps First is a function that returns the first item of a data source or table. The First function returns a single record or an item.
Syntax:
First( Table )
Where,
Table = This is required. You need to specify the table name to operate on
FirstN Function in Power Apps
PowerApps FirstN is a function that helps return the first set of records of a table. The second argument defines the number of records to be returned.
Syntax:
FirstN( Table [, NumberOfRecords ] )
Where,
- Table = This is required to specify the table name to operate on
- NumberOfRecords = This is an Optional that will help you to return the Number of records. If you do not specify this argument, then the function will return only one record or item
Power Apps Lookup First Record
I have a SharePoint list named “Employee Onboarding,” and this list contains the below fields.
| Column Name | Data Type |
| Employee ID | It is a default single line of text |
| Name | A single line of text |
| A single line of text | |
| Gender | Choice |
| Joining Date | Date and time |
| Department | Lookup |

This Lookup column [Department] is added from another SharePoint source list named “Departments,” which contains the fields below.
| Column Name | Data Type |
| Department | It is a default single line of text |
| Manager | Person or Group |

In Power Apps, there is a Data table control with SharePoint list records. I would like to display the first record on the data table using the Power Apps First function.
To achieve it, insert a Data table control on the Power Apps Screen and set its Items property using the code below.
Items = First('Employee Onboarding')
Where,
- ‘Employee Onboarding’ = SharePoint Online list

Now, Preview the app. The data table displays the first record of the SharePoint list, as shown below.

Similarly, to get the first four records from the SharePoint list, apply the formula below to the Data table’s Items property.
Items = FirstN('Employee Onboarding', 4)
Where,
4 = Number of records you want to display in the data table.

This is how we can use the First and FirstN Functions in Power Apps.
Last Function in Power Apps
Power Apps Last function returns the last item or record of a data source or table.
Syntax:
Last( Table )
Where,
Table = This is required to specify the table name to operate on