3 Steps to Filter a PowerApps Gallery for the Current User’s Records

If you have recently generated a PowerApps app from data, you probably ended up with a 3 screen app. The first page of that app probably has a gallery.

Basic default gallery

By default, anyone using the app sees all records. This gallery can be customized to only show the records of the user that is currently signed into Office 365.

Add a filter to restrict the gallery records

  1. In the Tree View, select the gallery and view the items property.
    The default Items property will probably have sort and filter active, already with some code much like this:

    SortByColumns(Filter([@’Support Service Portal’], StartsWith(Title, TextSearchBox1.Text)), “Title”, If(SortDescending1, Descending, Ascending))

    Right now, Items are filtered by whatever is typed in search box, when that text is found in the Title field. The results are sorted in descending order.
  2. We will simply inject another logical test in the middle of the existing statement. Type:

    User().FullName in ‘Claimed By’,

    before StartsWith. It should look like this:

    SortByColumns(Filter([@’Support Service Portal’], User().FullName in ‘Claimed By’, StartsWith(Title, TextSearchBox1.Text)), “Title”, If(SortDescending1, Descending, Ascending))

    ‘Claimed By’ is the the field where the user’s name is found. In your filter, type the name of your field.
  3. That’s it. All of the sort and original filter logic is still applicable but now the records are only for the current user. With no text in the search box, all records for the current user are shown.