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 and Filter Assist...
Power Apps
Unanswered

Sort and Filter Assistance

(0) ShareShare
ReportReport
Posted on by 1,168

Hi,

 

I am trying to follow along on this video where there is a need to get around delegation. My Sharepoint list has a Title, Account Type (Choice column) & Account Rating (Choice Column). I

 

My function was working fine before I tried to implement the Switch to address delegation.

Switch(
 varAccountsBrowseSortColumn,
 "Title",
 SortByColumns(
 Filter(
 'Accounts',
 StartsWith(
 Title,
 txtinpAccountsSearch.Text
 ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
 ),
 "Title",
 If( varAccountsBrowseSortColumn = Ascending, Ascending,Descending)),
 "Account Rating"
 SortByColumns(
 Filter(
 'Accounts',
 StartsWith(
 Title,
 txtinpAccountsSearch.Text
 ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
 ),
 "Account Rating",
 If( varAccountsBrowseSortColumn = Ascending, Ascending,Descending)),
 "Account Type",
SortByColumns(
 Filter(
 'Accounts',
 StartsWith(
 Title,
 txtinpAccountsSearch.Text
 ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
 ),
 "Account Type",
 If( varAccountsBrowseSortColumn = Ascending, Ascending,Descending))
)

 

Thanks in advance for any assistance.

 

Cheers

 

Todd

Categories:
  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Tango ,

     

    What is it that is not working? From a syntax perspective all seems correct...

  • Tango Profile Picture
    1,168 on at

    Thanks for your message,

     

    I just have squiggly lines all over the place and a little icon that says there is an error

  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Tango ,

     

    If you click on the App Checker, the stethoscope icon on the top right, you can find more details on the error:

     

    BCBuizer_0-1653480340999.png

    Can you please share these details?

  • Tango Profile Picture
    1,168 on at

    There is 15 errors

     

    Expected Operator. We expect an operator such as +,* or & at this point in the formula.

     

    Unexpected Characters. The formula contains 'ParenClose' where 'Comma' is expected

     

    Unexpected Characters. Characters are used in the formula in an expected way

     

    I think these are then repeated as extra switch blocks are added

  • Tango Profile Picture
    1,168 on at

    Here is the latest code

     

    The Title block of the Switch is fine. No Squigglys. I am getting squigglys at the Sort By columns section under Account Rating"  when hovering i get message "The function 'SortByColumns' has some invalid arguments

     

    Switch(
     varAccountsBrowseSortColumn,
     "Title",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Title",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     ),
     "Account Rating",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Account Rating",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     ),
     "Account Type",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Account Type",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     )
    )

     

     

  • Tango Profile Picture
    1,168 on at

    just worked this out i think.

     

    it was because I was trying to sort non delegable fields. Account Type & Account Rating are Choice fields

  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    HI @Tango ,

     

    The below code should fix the errors, but you'll still be left with delegation issues, depending on the size of your data source:

     

    Switch(
     varAccountsBrowseSortColumn,
     "Title",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Title",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     ),
     "Account Rating",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Account Rating.Value",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     ),
     "Account Type",
     SortByColumns(
     Filter(
     'Accounts',
     StartsWith(
     Title,
     txtinpAccountsSearch.Text
     ) && ('Account Rating'.Value = drpAccountRating.Selected.Value || drpAccountRating.Selected.Value=Blank()) && ('Account Type'.Value = drpAccountType.Selected.Value || drpAccountType.Selected.Value=Blank())
     ),
     "Account Type.Value",
     If(
     varAccountsBrowseSortColumn = Ascending,
     Ascending,
     Descending
     )
     )
    )

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 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard