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 / How to Sort and Filter...
Power Apps
Answered

How to Sort and Filter Gallery at the same time

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there,

 

I am currently working on the gallery portion of the application. Currently at the gallery level, I have used Items :If(varAdmin, 'Big Ideas Tool', Filter('Big Ideas Tool','Created By'.Email=User().Email)) and set the Onvisible:If(User().Email="xxx@abc.org",Set(varAdmin,true)); UpdateContext({varDateSort:Blank()}) to set that email address as an admin to to view all information. Any other email address would only be able to see their results. I want to put a Sortbycolumn function to sort the gallery by date but its not allowing me to filter and sort the list at the same time. 

 

If(varAdmin, 'Big Ideas Tool', Filter('Big Ideas Tool','Created By'.Email=User().Email)) ;
SortByColumns('Big Ideas Tool',"Date")

 

this function is keep failing me. Help will be appreciated!

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Please consider changing your Formula to the following:

    SortByColumns(
     Filter('Big Ideas Tool',
     'Created By'.Email=User().Email || varAdmin
     )
     "Date"
    )

    Try to avoid using If's in your formulas for Items.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That did not work. Is there a reason why I should not use a If statement in Items property?

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Yes, it can quickly cause schema issues for the editor and it also doubles your work in most cases.

    What about the formula did not work?

    You can also consider (because many times the letter case of User().Email is different than the letter case of the SharePoint users) the following formula:

    SortByColumns(
     Filter('Big Ideas Tool',
     StartsWith('Created By'.Email, User().Email) || varAdmin
     )
     "Date"
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I tried it multiple times and its still giving me this error. 323123213.PNG

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Please scrub through the formulas I provide as I type them by hand without the aid of a design editor...there is a comma missing.  Should be:

    SortByColumns(
     Filter('Big Ideas Tool',
     StartsWith('Created By'.Email, User().Email) || varAdmin
     ),
     "Date"
    )

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 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard