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 / Help with filter on Ga...
Power Apps
Answered

Help with filter on Gallery

(0) ShareShare
ReportReport
Posted on by 75

Hi, I am trying to build a little storefront but I am still having trouble with filtering.

 

I have a List called, 'Store Data - Categories' with the Title field renamed to 'CategoryName' and another list called 'Store' also with a filed called 'CategoryName'

In my app, I have two galleries 'Options' (which is the 'Store' List in SP) and 'Categories' (which is 'Store Data - Categories' in SP)

 

I am trying to only show the items (from 'Options') that match the selected category, I tried this but it doesn't work.

SortByColumns(Filter('Store Data - Categories', And(Title = Categories.Selected)))

 

Can anyone help? Think I might just be confused because I named my Galleries differently to the SP List and I'm not sure what the filter is requiring, but I have tried different combos and they didn't work.

 

 

Categories:
I have the same question (0)
  • UserInterface7 Profile Picture
    75 on at

    OK. Based on another post I think this might be closer but it still fails.

     

    SortByColumns(Filter(Categories, ("CatagoryName" = Categories.Selected.CatagoryName in CatagoryName)), "CatagoryName", If(SortDescending1, Descending, Ascending)) 

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Try this in the Item properties of the second gallery ('Categories').

     

    SortByColumns(
     Filter(
     'Store Data - Categories', 
     Title = Options.Selected.CatagoryName
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    ) 

    This assumes the first gallery is named Options ('Store' List in SP) and the Title column that was renamed is in the Categories gallery ('Store Data' list in SP).

  • UserInterface7 Profile Picture
    75 on at

    The assumptions are correct but I get an error 'This rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value.' Is that because I gave the field the same name in both tables?

     

     

  • UserInterface7 Profile Picture
    75 on at

    OK. I have recreated and named everything a bit better so that I would be less confused. I feel like what I now have should work, but I must still be missing something.

     

    SortByColumns(Filter('XXXXXX Store',GroupLabel=Category.Selected.CategoryName),Group,If(SortDescending1, Descending, Ascending))

     

    'XXXXXX Store' is the name of the SP list that contains all the asset information. It seems to only work when I give this name, not the 'Store' name that is in my app.

     

    All the highlighting seems correct, but it is failing on the sort for some reason.

     

    I also recreated the column one the SP list as I think it was getting confused with them having the same name.

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    I am not sure if I understand what is in each gallery but lets give it another try. Add this to the Items property of the Options gallery. 'Something Store' should be the name of the list that populates the options gallery (the gallery with all the laptop pics).

     

    SortByColumns(
     Filter(
     'Somthing Store', 
    	CategoryName = Categories.Selected.Title
     ),
     "CategoryName", If(SortDescending1, Descending, Ascending)
    )
  • UserInterface7 Profile Picture
    75 on at

    Hey Jeff, I have just edited my last post as even I was getting confused. 

    I have a gallery called Category which uses a data source SP list of 'XXXXX - Store Data Categories', The Title field on the SP List holds the info (Desktops/Laptops etc)

    I have a second gallery called Store, which uses a data source SP list called 'XXXXX Store', on this one I now have a field called 'Group' that holds a matching group name (Desktops/Laptops etc).

     

    Hopefully, that is less confusing.. 

     screen4.png

     

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Is the new field "Group" or "GroupLabel"? The screenshot shows "GroupLabel". The new field is a Text field and not a choice or lookkup field?

     

    Based on what I understand the Items Property should look something like this:

    SortByColumns(
     Filter(
     'XXXXX Store', 
    	Group = Category.Selected.Title
     ),
     "Group", If(SortDescending1, Descending, Ascending)
    )

    The first gallery (Category) just has 'XXXXX - Store Data Categories' in the Items properties?

  • UserInterface7 Profile Picture
    75 on at

    New filed is called 'Group' in the SP List (Sharepoint Online), and 'GroupLabel' in the Gallery. When I tried to use the same name in the gallery it was giving an error and making the field black, so I added label to the end of the name to get around that problem.

     

    It is now just a plain text field as before it was a Choice and I couldn't see it to add it to the gallery.

     

    When I try your code I get the same issue as before "The function 'If' has some invalid arguments"

     

    And yes, the first gallery (that has the category images) just has 'XXXXX - Store Data Categories' in the Items properties

  • UserInterface7 Profile Picture
    75 on at

    I thought this was correct. 

    SortByColumns(Filter('XXXXX Store',GroupLabel=Category.Selected.CategoryName),Group,If(SortDescending1, Descending, Ascending))

    When i look at the highlighting in the image, it looks like it is doing the right thing..

    Just when i click it doesn't do anything, although, it also gets same error "The function 'If' has some invalid arguments"

     

    Just adding in my SP list names and Columns 

    screen6.PNGscreen5.png

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    FYI: when using SortByColumns the second parameter (in this case Group) needs to be in double quotes ("Group"). Also PowerApps uses the internal SharePoint field name which is the name it was given when it was created. Anytime you change a field name in SharePoint you are just changing the display name.

     

    Why do you have "Category.Selected.CategoryName"? I thought CategoryName was a rename of the Title field in "Store Data - Categories", so it should be called "Category.Selected.Title".

     

    I don't understand how you are changing the field "Group" to "GroupLabel" in the Gallery.

     

    Lets try and simplify it to see if we can get it working.

     

    Filter('XXXXX Store', Group = Category.Selected.Title)

    'XXXXX Store' needs to be changed to the actual name of the list but don't change anything else. After the code is in and if there are no errors then click on category and see if it filters.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard