web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

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,297 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
    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,297 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
    on at

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

  • RandyHayes Profile Picture
    76,297 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard