Introduction

In this blog post, we'll cover two important functions in PowerApps: First and Last. These functions help you get particular information from your data. I will explain how they work in easy terms, so you can use them to find the first or last items in your data source.

First Function

The First function returns the first record from a data source or a collection. It is commonly used with galleries or forms to display initial data.

Syntax

Code
First(DatasourceName)

Last Function

The Last function returns the last record from a data source or a collection. It is commonly used with galleries or forms to display initial data.

Syntax

Code
Last(DatasourceName)

Example

First Function Output: As you can see my gallery is showing only the first record stored in my collection

First function output

Last Function Output: As you can see my gallery is showing only the last record stored in my collection.

Last function output

Conclusion

These are just basic examples of how you can use the First and Last functions in PowerApps. Similarly, we have FIRSTN and LASTN functions in PowerApps which I will cover in the next blog.