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 / Gallery Filtering Not ...
Power Apps
Answered

Gallery Filtering Not Working

(0) ShareShare
ReportReport
Posted on by 829

Hi Folks -

 

I have the following formula for my gallery:

SortByColumns(
	AddColumns(
		Filter(rdAssets, 
			StartsWith(Alias, TextSearchBox4.Text) || 
			StartsWith(Name, TextSearchBox4.Text) ||
			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Development_Name, TextSearchBox4.Text) ||
			StartsWith(Alternate_Name, TextSearchBox4.Text) && !(Portfolio_x0020_Status.Value="Terminated")), 
	"txtPortfolioStatus", Portfolio_x0020_Status.Value),
	"txtPortfolioStatus", If(SortDescending1, Descending, Ascending),
"Alias", If(SortDescending1, Descending, Ascending)
)

The issue is that I'm still able to see "Terminated" values and I'm not sure why. 

 

 

For instance:

 

PFC.jpg

 

Gallery Search:

pfc visible.jpg

Based on my formula, would there be any reason why this is?  The field "GovernanceStatus" is a Choice field, if that makes a difference?

 

Thanks!

Categories:
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @simms7400 

     

    Please refer to: 

     

    SortByColumns(
        AddColumns(
            Filter(rdAssets, Or(StartsWith(Alias, TextSearchBox4.Text),StartsWith(Name, TextSearchBox4.Text),StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text),StartsWith(Brand_x0020_Name, TextSearchBox4.Text),StartsWith(PF_Research_Code, TextSearchBox4.Text),StartsWith(Generic_x0020_Name, TextSearchBox4.Text),StartsWith(Development_Name, TextSearchBox4.Text),StartsWith(Alternate_Name, TextSearchBox4.Text)) && !(Portfolio_x0020_Status.Value="Terminated")),
        "txtPortfolioStatus", Portfolio_x0020_Status.Value),
        "txtPortfolioStatus", If(SortDescending1, Descending, Ascending),
    "Alias", If(SortDescending1, Descending, Ascending)
    )
     
    This is because whenever one of your || condition satisfies, it shows the data and ignores all the other condition. 
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @simms7400 ,

    Please try this formula:

    SortByColumns(
    	AddColumns(
    		Filter(rdAssets, 
    			StartsWith(Alias, TextSearchBox4.Text) || 
    			StartsWith(Name, TextSearchBox4.Text) ||
    			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
    			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(Development_Name, TextSearchBox4.Text) ||
    			StartsWith(Alternate_Name, TextSearchBox4.Text) ,
    !(Portfolio_x0020_Status.Value="Terminated")
    ), "txtPortfolioStatus", Portfolio_x0020_Status.Value
    ),
    "txtPortfolioStatus", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending), "Alias", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending) )

     Filter(table,formula1,formula2) 

    formula1 and formula2 is combined with "And".

    Here's doc for your reference:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

     

     

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • simms7400 Profile Picture
    829 on at

    @v-yutliu-msft 

     

    That worked perfectly, thank you so much! I now went through an updated all my galleries with tha logic!

    One thing I'm noticing with one particular gallery is that when I add the "Portfolio Status" condition (to exclude), it does not show some data elements even though they are NOT "Terminated".

     

    Here is the formula that works and displays all data elements:

    SortByColumns(
    	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
    		Or(
    		StartsWith(ProjectAlias, TextSearchBox5.Text),
    		StartsWith(ProjectCode, TextSearchBox5.Text),
    		StartsWith(IND_DESC, TextSearchBox5.Text),
    		StartsWith(IND_CODE, TextSearchBox5.Text))),
    "ProjectAlias", If(SortDescending1, Descending, Ascending)
    )

    But when I add the exclusion condition, it doesn't display correctly and its excluding data elements even WITH a Portfolio Status of "Active".

     

    SortByColumns(
    	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
    		Or(
    		StartsWith(ProjectAlias, TextSearchBox5.Text),
    		StartsWith(ProjectCode, TextSearchBox5.Text),
    		StartsWith(IND_DESC, TextSearchBox5.Text),
    		StartsWith(IND_CODE, TextSearchBox5.Text)) && !(PortfolioStatus.Value="Terminated")),
    "ProjectAlias", If(SortDescending1, Descending, Ascending)
    )

    What could be the issue?

     

    Thanks!

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @simms7400 ,

    I notice that the choice name is "GovernanceStatus" in Access table.

    Could you tell me why you use "PortfolioStatus" in formula?

    Try this:

    SortByColumns(
    	AddColumns(
    		Filter(rdAssets, 
    			StartsWith(Alias, TextSearchBox4.Text) || 
    			StartsWith(Name, TextSearchBox4.Text) ||
    			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
    			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
    			StartsWith(Development_Name, TextSearchBox4.Text) ||
    			StartsWith(Alternate_Name, TextSearchBox4.Text) ,
    !(GovernanceStatus.Value="Terminated")
    ), "txtPortfolioStatus", GovernanceStatus.Value
    ),
    "txtPortfolioStatus", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending), "Alias", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending) )

     

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • simms7400 Profile Picture
    829 on at

    @v-yutliu-msft  Thanks for your reply.

     

    What happened was in SharePoint, I renamed to "GovernanceStatus" from "PortoflioStatus". Therefore, POwerApps only recognizes the old name unless I completely delete the SP Column and re-add.

     

    See screen shot below:

    GOV.jpg

  • simms7400 Profile Picture
    829 on at

    I have solved this, it was a syntax error on my part.

     

    Thank you!

  • simms7400 Profile Picture
    829 on at

    Nevermind, I was mistaken.  Same issue.

  • simms7400 Profile Picture
    829 on at

    This is my formula and for some reason, it's still including data elements that have a value of "Terminated" for "PortfolioStatus"

     

    SortByColumns(
    	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
    		Or(
    		StartsWith(ProjectAlias, TextSearchBox5.Text),
    		StartsWith(ProjectCode, TextSearchBox5.Text),
    		StartsWith(IND_DESC, TextSearchBox5.Text),
    		StartsWith(IND_CODE, TextSearchBox5.Text), !(PortfolioStatus.Value="Terminated"))),
    "ProjectAlias", If(SortDescending1, Descending, Ascending)
    )
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @simms7400 

     

    The code is not working properly, maybe because you added the closing bracket at the wrong place, it is considering Status condition inside the Or clause. Please use the following expression and this should resolve your issue:
    SortByColumns(
        Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
            Or(
            StartsWith(ProjectAlias, TextSearchBox5.Text),
            StartsWith(ProjectCode, TextSearchBox5.Text),
            StartsWith(IND_DESC, TextSearchBox5.Text),
            StartsWith(IND_CODE, TextSearchBox5.Text)), !(PortfolioStatus.Value="Terminated")),
    "ProjectAlias", If(SortDescending1, Descending, Ascending)
    )
    Hope this Helps!
  • simms7400 Profile Picture
    829 on at

    @yashag2255  Ah yes, my bad. It was a syntax issue. Silly mistake on my part.

     

    Thanks again!

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard