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 / Dynamic AND/OR in filter
Power Apps
Answered

Dynamic AND/OR in filter

(0) ShareShare
ReportReport
Posted on by 21

I have multiple dropdowns that I am using to filter a gallery. The problem I am having is that I can either do an && or || which limits how my users will be able to view the data. What I would like to do, and currently failing at, is create a dropdown that contains the value "And, Or" so end users can adjust how they view the data.

 

 

 

SortByColumns(Filter('Contoso List', Dropdown1.Selected.Value in Field1.Value Selector1.Selected.Value Dropdown2.Selected.Value in Field2.Value), "Title")

 

 

 

Where Selector1 is a dropdown that has the items property set to ["And", "Or"]. The error that is thrown: We expect an operator such as +, *, or & at this point in the formula.

 

Is it possible to create a complex dynamic query like this or is there a better/alternative method to accomplishing this?

Categories:
I have the same question (0)
  • Verified answer
    Rivius Profile Picture
    269 on at

    It's probably getting hung up on having a variable instead of a reserved name at that point of the formula.  You could achieve what you're doing by having some Switch() statements in there but it could get really hairy depending on how many fields you're dealing with.

     

     

    Switch(Selector1.Selected.Value,
    "And",SortByColumns(Filter('Contoso List', Dropdown1.Selected.Value in Field1.Value && Dropdown2.Selected.Value in Field2.Value), "Title"),
    "Or",SortByColumns(Filter('Contoso List', Dropdown1.Selected.Value in Field1.Value || Dropdown2.Selected.Value in Field2.Value), "Title")
    )

     

     

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
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard