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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sort by columns for ch...
Power Apps
Suggested Answer

Sort by columns for choice column (cannot sort on the expression type)

(1) ShareShare
ReportReport
Posted on by 6
Hi, I have below code on the OnStart property and I want to sort my modern data table by status choice column instead of title. When I change it to "Status" i will encounter expression type error. 
SortByColumns(
    ClearCollect(
        reportList,
        AddColumns(
            Filter('[Trial] PBI to SP', UserID=User().Email),
            rStatus,
            LookUp(
                '[Trial] PBI Report Registration',
                '[Trial] PBI Report Registration'[@UniqueID] exactin '[Trial] PBI to SP'[@UniqueID],
                Status
                
            )
        )
    ),
    "Title"
);
 
Categories:
I have the same question (0)
  • Suggested answer
    narayan225 Profile Picture
    2,547 Super User 2025 Season 2 on at
    On SortByColumns expression, at the end, you have defined title as the field you would like to sort by. You will need to change that to the status column or any other column that you would like to sort by.
     
     
    Hope this helps.
    Cheers!
  • CU16080510-3 Profile Picture
    6 on at
     Hi, as stated in my post, when I put status I got the error expression type error (It is a choice column not sure if it will impact anything)
  • Meekou Profile Picture
    200 Moderator on at
    You could not sort on Choice Column directly, you can add columns by Status value and then sort by Status value.
     
    Here is a sample which Status is a choice column
     
    ClearCollect(
        Test,
        SortByColumns(
            AddColumns(
                StudentsInfo,
                SortAbleStatus,
                Status.Value
            ),
            "SortAbleStatus"
        )
    )
     
     
  • CU16080510-3 Profile Picture
    6 on at
    Hi, i have changed it to Status.Value and changed title to rStatus or Status or "Status" or "rStatus". All got error.
  • Meekou Profile Picture
    200 Moderator on at
    Share a demo which including the test data and could reproduce your issue.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard