Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

Trying to sort gallery items as its default view on the basis of label in each item

hello experts,

I have a gallery , in which items are shown, and i have added a label in it on the basis of the below formula, in which it will show true/false based on the lookup function. And i have also made visibility of the items on the basis of this label as well

LookUp(DataSource,User().Email in ThisItem.Column1.Email,true) "

and i want the default view of my gallery to be showing items with true values first then the false ones.

below is the screenshot of the gallery.


snap of gallerysnap of gallery


and the formula that i am trying to make it work with in 'Items' category of gallery. 

SortByColumns(Search(DataSource, CProjects_TextSearchBox1.Text, "Project","ProjectCountry"),"Project", If(SortDescending1,Descending,Ascending))


in 'Default' category of gallery

Sort(DataSource, Label35.Text,Descending)


please help!


Super User III
Super User III

Re: Trying to sort gallery items as its default view on the basis of label in each item

In the Default, you cannot put the formula there. Also sorting has to do with multiple rows in a Column therefore you cannot Sort using the label.


I recommend you maintain

SortByColumns(Search(DataSource, CProjects_TextSearchBox1.Text, "Project","ProjectCountry"),"Project", If(SortDescending1,Descending,Ascending))


And ignore the sorting with the label.

Since you have a button to Sort ascending or Descending or rather use that button.


If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.


Re: Trying to sort gallery items as its default view on the basis of label in each item


Based on the issue that you mentioned, do you want to Sort the gallery based on the Label35?

Let me make it easy for you, please check the standard formula as below.

Sort( Table, Formula [, SortOrder ] )

This formula is evaluated for each record of the table, and the results are used to sort the table. You can reference columns within the table. Values from Label35 cannot be sorted for it is a single control within PowerApps.

As an alternative solution, you can try to filter the gallery based on the current user.




Then you can create a nested Sort() by adding this Filter() to the formula you provided.

Best Regards,



Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,395)