When you are working with the Power Apps data table, you may want to sort the Power Apps data table. Thankfully, there are two Power Apps functions, i.e., [Sort() and SortByColumn()], to sort the Power Apps data table records.
In this article, I will explain how to sort data table in Power Apps with real-time examples. Also, we will discuss how to sort and filter the Power Apps data table.
How to Sort Data Table in Power Apps
While working with the Power Apps Data table control, we usually need to sort the data table per our requirements. Now, I will show you how to sort the Power Apps data table in different scenarios. Such as:
- How to Sort Power Apps Data Table Alphabetically [A-Z or Z-A]
- Sort Power Apps Data Table By Ascending and Descending
- How to Sort and Filter Power Apps Data Table
Sort Power Apps Data Table Alphabetically
I have a Power Apps data table that retrieves all the records from my Power Apps collection [colEventRegistration], as in the screenshot below.

Now, I would like to sort the Power Apps data table Alphabetically [Ascending or Descending]. Have a look at the below output.

To work around this, follow the below steps. Such as:
1. Open Power Apps with your respective Microsoft credentials -> Create a Blank canvas app -> Select App object and set its OnStart property to the code below.
OnStart = ClearCollect(
colEventRegistration,
{
Name: "John Smith",
CompanyName: "Buckeyee Furniture",
Occupation: "Training and development specialist",
Age: 34,
Gender: "Female"
},
{
Name: "Emma Reyna",
CompanyName: "Fox valley CPAs",
Occupation: "Accountant",
Age: 32,
Gender: "Female"
},
{
Name: "Kelven",
CompanyName: "Bugle Boy",
Occupation: "Daimond Tracker",
Age: 44,
Gender: "Male"
},
{
Name: "Lynee",
CompanyName: "Specific Appraisals",
Occupation: "Computer and Information Researcher",
Age: 40,
Gender: "Male"
},
{
Name: "Steve Mroz",
CompanyName: "Maxigraphics",
Occupation: "Graphic Designer",
Age: 39,
Gender: "Male"
},
{
Name: "Henrita Mullar",
CompanyName: "Happy Harry's",
Occupation: "Customer Suppot Executive",
Age: 36,
Gender: "Female"
}
)
Where,
- colEventRegistration = Power Apps Collection Name
- Name, CompanyName, Occupation, Age, Gender = Collection Headers/Columns
- “John Smith”, “Buckeyee Furniture”, “Training and development specialist” = Collection Records/Rows

2. On the Power Apps Screen -> Insert a Data table control and set its Items property to the code below.
Items = Sort(
colEventRegistration,
Name
)
Where,
- Sort() = Power Apps Sort() function helps us to sort the table depending on the formula
- colEventRegistration = Power Apps collection name
- Name = Collection text field

3. Once your app is ready, Save, Publish, and Preview the app. The data table sorts and displays each record from the collection based on the ascending order [A-Z] like below.

4. Also, if you want to sort the Power Apps data table in descending order [Z-A] then select the Data table and set its Items property as:
Items = SortByColumns(
colEventRegistration,
"Name",
SortOrder.Descending
)

5. Look at the screenshot below to see how we can sort the Power Apps data table records in descending order.
This