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 with an If Statement
Power Apps
Answered

Sort with an If Statement

(0) ShareShare
ReportReport
Posted on by 4

New to Power Apps - thanks for the help on what I feel has to be an elementary question.

 

How do I sort a gallery when “ALL” is selected by “Created” the base code is this:

 

If(searchdropdown.Selected.Value="All",Receipts, Sort(Filter(Receipts,creditcard.Value=searchdropdown.Selected.Value),Created,Descending))

 

The sort is working when I select a value other than “All” in the drop down box. I’ve tried everything I could think of with my limited knowledge of Power Apps. 


Thanks.

Categories:
I have the same question (0)
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    I confirm that your original statement doesn't work. I can get this statement to work when there is a Sort on both options for the If() statement:

    If(searchdropdown.Selected.Value="All",
     Sort(Receipts, Created, Descending), 
     Sort(Filter(Receipts,creditcard.Value=searchdropdown.Selected.Value),Created,Descending)
    )

    Try and see if this works for your situation.

     

    Bryan

  • Jct7878 Profile Picture
    4 on at

    This worked perfectly. Thanks!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard