Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Trying to add Sort to this Filter Syntax and its not working

(0) ShareShare
ReportReport
Posted on by

I'm trying to add a sort to this syntax on the Item property of a gallery.

 

Current Syntax on Item

 

Filter(
'Org Chart',
'Reporting Manager' = Gallery3_1.Selected.Employee

 

I'm trying to add a sort based off of a column titled "Status" in descending order but it is not taking. Not sure what i'm doing wrong here. See below.

 

SortByColumns(Filter('Org Chart','Reporting Manager' = Gallery3_1.Selected.Employee)), "Status", descending)

Categories:
  • punksterz626 Profile Picture
    punksterz626 on at
    Re: Trying to add Sort to this Filter Syntax and its not working

    this was the one that ended up working. Thank you.

  • Verified answer
    LaurensM Profile Picture
    LaurensM 12,510 on at
    Re: Trying to add Sort to this Filter Syntax and its not working

    Hi @punksterz626,

     

    My apologies, I only now saw your response on the previous topic. 

    @Rusk's solution should do the trick 😊.

     

    To add upon Rusk's answer: if the 'status' column is a choice column (no multi-select) you could use the following code:

    Sort(
     Filter( 
     'Org Chart', 
     'Reporting Manager' = Gallery3_1.Selected.Employee
     ), 
     Status.Value, 
     Descending 
    )

     

    I hope this helps!

  • Rusk Profile Picture
    Rusk 1,369 on at
    Re: Trying to add Sort to this Filter Syntax and its not working
    SortByColumns( Filter( 'Org Chart', 'Reporting Manager' = Gallery3_1.Selected.Employee ), "Status", Descending )

     

    The main issue with the original formula was that the "Descending" argument was outside of the SortByColumns function's parentheses. In the corrected formula, "Descending" is included as a third argument within the parentheses, which tells Power Apps to sort the data in descending order based on the "Status" column.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard