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 / If statement with mult...
Power Apps
Answered

If statement with multiple conditions

(0) ShareShare
ReportReport
Posted on by 71

I'm trying to filter a gallery using one dropdown and one text input/search bar, and I'm having trouble getting both of them to work at the same time. I'm used to Excel where I can nest If statements easily, but I'm running into issues in PowerApps. What I have now is:

 

If(IsBlank(drpColor) && IsBlank(TextInput1), 'Shoe Inventory Finals', If(IsBlank(drpColor) && !IsBlank(TextInput1), Search('Shoe Inventory Finals', TextInput1.Text, "cr1ae_productname", If(!IsBlank(drpColor && IsBlank(TextInput1), Filter('Shoe Inventory Finals', Color = drpColor.Selected.Value, Search(Filter('Shoe Inventory Finals', Color = drpColor.Selected.Value), TextInput1.Text, "cr1ae_productname")
 
What I want it to do is check if both the dropdown and the input are blank, and return the whole table if true. If not true, check if only one is blank and filter appropriately. If none of these conditions are true, meaning both the dropdown and the text input are not blank, I want to filter the list based on both of them.
 
Thanks in advance!!
Categories:
  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @arinard - I think the below is what you're trying to do:

    Search(
     Filter(
     'Shoe Inventory Finals',
     Len(drpColor.Selected.Value) = 0 || Color = drpColor.Selected.Value
     ),
     TextInput1.Text,
     "cr1ae_productname"
    )

     

    I can see from your code that your data source is Dataverse. The above assumes the Color field is a Single Line Text data type in your table.

  • arinard Profile Picture
    71 on at

    Hi @Amik, thanks for your response. My source is Dataverse, however the Color column is in choice format. Are there edits needed to make it work? I'm not familiar with the Len function.

  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @arinard - the answer depends on what you have in the Items property of that Dropdown control

  • arinard Profile Picture
    71 on at

    @Amik The Items property is Choices(ColorList). ColorList is a collection that is created in the OnVisible property of the screen from the choices available in the Color column of my data.

  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @arinard - is there a reason you're creating a Collection of the Choices field values, rather than simply referring to the Choices field directly?

  • arinard Profile Picture
    71 on at

    @Amik That's how I saw it done in a tutorial, but I can change it to just refer to the choices if that's the best way. It works when I change the Items field for the dropdown to Choices('Shoe Inventory Finals'.Color), with Shoe Inventory Final being my source table

  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @arinard - whoever did that tutorial was wrong, or they were trying to do something else. 

     

    Is your Choice field Local or Global?, the syntax you provided is one that I recognise as valid for SharePoint, but not for Dataverse.

     

    Choices('Shoe Inventory Finals'.Color)

     

  • arinard Profile Picture
    71 on at

    @Amik My Choice field is Local

  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @arinard - would you mind clicking on the Items property and sharing a screenshot of the formula bar. I am struggling to believe that this is valid syntax for a Dataverse Local Choice.

  • arinard Profile Picture
    71 on at

    @Amik I very well may have just gotten lucky, I'm a total beginner with PowerFx. 

     

    Here is the formula bar with the dropdown in the body of the app seemingly pulling the choices:

    arinard_1-1711236070439.png

     

    I'd be happy to change the syntax if you know the correct syntax to use

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard