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 / 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 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard