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 / SortByColumns "Cannot ...
Power Apps
Answered

SortByColumns "Cannot sort on the expression type"

(0) ShareShare
ReportReport
Posted on by 256

In Power Apps, I am using the following statement:

 

 

SortByColumns(
 Filter(
 SPListSource,
 'User'.DisplayName = User.Selected.Result && StartsWith(
 Title,
 SearchInput1.Text
 )
 ),
 "Status",Ascending
 )

 

 

However, Power Apps is not liking this statement. When I use another column (such as a date or number column) it works fine. However, this column it does not like and returns a "Cannot sort on the expression type" error. The SPListSource is a Microsoft Lists data set and the column "Status" inside of Lists is of type "Choice" that does not allow multiple selections.

 

I have even tried using "Status".value, but it didn't like that.

 

I also tried:

 

SortByColumns(
 Filter(
 SPListSource,
 'User'.DisplayName = User.Selected.Result && StartsWith(
 Title,
 SearchInput1.Text
 )
 ),
 "Status",["Completed","Assigned","On Hold"]
 )

 

but it didn't like the formatting in the above when I manually chose the order for the column options.

 

Has anyone ever come across this issue before or offer advice?

 

thanks in advance!

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,419 Most Valuable Professional on at

    Hi @galos ,

    You cannot sort by complex field types - try this

    SortByColumns(
     AddColumns(
     Filter(
     SPListSource, 
     'User'.DisplayName = User.Selected.Result && 
     StartsWith(
     Title,
     SearchInput1.Text
     )
     ),
     "StatVal",
     Status.Value
     ),
     "StatVal"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • galos Profile Picture
    256 on at

    Thanks for your quick reply @WarrenBelz !  It didn't seem to like that, it was expecting "ascending" or "descending" when I closed the quotes for "StatVal" in your suggestion above. Are you trying to suggest I create a variable called "statVal" and set it to the value of the Status column? Would I need to use the "set" function for that to work? I'm trying some forms of that now, but it doesn't seem to like "set" either.  I forgot to mention that this formula is in a gallery

  • galos Profile Picture
    256 on at

    gah! @WarrenBelz I just now saw the AddColumns() function you suggested. That worked! Thank you!!!

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
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard