web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filtering a SharePoint...
Power Apps
Answered

Filtering a SharePoint List and sorting

(0) ShareShare
ReportReport
Posted on by 782

I was populating a DropDown field with the contents of a SharePoint list where the Value of a Yes/No field = "Y". I changed the SharePoint List field from "Yes/No" to a Single line of text data type and this no longer works. The statement was:

 

Filter(Available_Schools, Enabled_Class.Value = "Y")

 

This doesn't work if Enabled_Class is changed from a data type of Single line of text. I also want to sort the data by a column named DisplayOrder.

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    if it's single line of text code should be

    Filter(Available_Schools, Enabled_Class = "Y")

    IF it's choice type field code will be

    Filter(Available_Schools, Enabled_Class.Value = "Y")

    if you want to sort using text columm

    SortByColumn(Filter(Available_Schools, Enabled_Class = "Y"),Enabled_Class,Ascending)

  • Greg27 Profile Picture
    782 on at

    @zmansuri 

    The statement didn't work, though I changed the value in SortByColumn from Enabled_Class to Display Order. I want to display the results of the DropDown by Display order, not by Enabled_Class. So, here is my new statement:

    SortByColumn(Filter(Available_Schools, Enabled_Class = "Y"),DisplayOrder,Ascending)

    Am I missing something?

  • Greg27 Profile Picture
    782 on at

    @zmansuri 

    Let me add that the Filter statement worked perfectly, it's just adding the SortByColumn statement that breaks it.

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    What do you mean you want to sort dropdown? Share some details and pics

  • Greg27 Profile Picture
    782 on at

    @zmansuri 

    I have 3 rows in my SharePoint List "Available_Schools". 2 are enabled and 1 is not. So, I want to populate by DropDown with only the rows in my SharePoint List that are enabled. That works fine. However, I don't want the DropDown to be populated in the order the SharePoint List is read. I have a field in my List named DisplayOrder, and I want to order it by that. DisplayOrder is a data type Number. I tried adding Text() around DisplayOrder to convert DisplayOrder to text hoping that would fix the problem, but it didn't.

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Does display order have numbers like 1,2,3? try this

    Sort(Filter(Available_Schools, Enabled_Class = "Y"),DisplayOrder,Ascending)

     

    Also you don't need seprate column for this if there are only few values. Let's say your values are January, February ,March. Alphabetically they will be sorted as February, January ,March. So what you can do is

    SortByColumn(ListName,ColumnName,["January","February","March"])

    So, it's not necessary to give sorting order as Ascending or Descending. 

  • Greg27 Profile Picture
    782 on at

    @zmansuri 

    Sort worked. Yes, DisplayOrder has numbers like 1, 2, 3, etc. Is there a reason it worked and not SortByColumn? We only have a few rows of data, but we want to make sure that it showed up in a certain order.

  • Verified answer
    zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Sort works with formula, SortByColumn works with Columns. You can read more about that here:

    Sort and SortByColumns functions in Power Apps - Power Apps | Microsoft Docs

     

    If it worked for you can you mark Accept As Solution So others can find it in future

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard