How to Sort a Power Apps Gallery by Creation Date
Question details
The user wants to organize a gallery in Power Apps so that the items are sorted chronologically based on their creation date instead of the default title sorting.

- Product
- Microsoft Power Apps
- Device & OS
- not provided
- Scenario
- Developing or customizing an application in Power Apps and managing how data is displayed in a gallery component.
- Observed behavior
- The gallery displays items, but needs a specific formula applied to the Items property to reorder them by the creation date column.
Ensure you have edit permissions for the Power App and know the exact internal name of your data source's creation date column, which is typically "Created".
Use the SortByColumns Function in the Items Property
Apply the SortByColumns function combined with your existing Filter formula to sort the gallery by the creation date.
To properly sort a gallery, you must modify its Items property. By default, galleries might sort by a primary column like 'Title'. Wrapping your data source or filter formula in the SortByColumns function allows you to specify the exact column and order for your items.
Open your app in the Power Apps editing canvas and click on the Gallery control you want to sort.
Navigate to the Properties pane on the right or use the formula bar at the top to select the 'Items' property.
Modify the existing formula to include SortByColumns. For example, enter: SortByColumns(Filter(YourDataSource, YourCondition), "Created", SortOrder.Descending). Replace 'YourDataSource' and 'YourCondition' with your specific app details.
If you want the oldest items to appear first instead of the newest, change 'SortOrder.Descending' to 'SortOrder.Ascending'.

Boost Your Productivity with WPS Office
While Power Apps handles your custom business applications, you still need a reliable suite for daily documents, spreadsheets, and presentations. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office.

Frequently Asked Questions
Why is my Power Apps gallery not sorting by the Created column?
This usually happens if the column name is misspelled or if you are using the display name instead of the logical internal name. Ensure you use the exact internal name (e.g., "Created") enclosed in double quotes.
Can I sort by multiple columns in a Power Apps gallery?
Yes, you can add multiple column names and sort orders within the SortByColumns function, separated by commas, such as SortByColumns(DataSource, "Column1", SortOrder.Ascending, "Column2", SortOrder.Descending).
How do I toggle between ascending and descending sort order?
You can use an icon or toggle control that updates a context variable (e.g., UpdateContext({SortDescending: !SortDescending})), and use an If statement in your SortByColumns formula to switch between SortOrder.Descending and SortOrder.Ascending dynamically.




