How to Filter Power Apps Collection By Logical Operators?

Did you have a requirement to filter the Power Apps collection using a logical operator? If yes, then follow this complete tutorial.

In this Power Apps tutorial, I will explain how to filter Power Apps collection by logical operators like And operator, Or operator, etc.

How to Filter Power Apps Collection By Logical Operators

Here, I will show you how to filter a Power Apps collection by using logical operators like:

Logical OperatorDescription
AND operatorIf both controls are true then it gives a result. [Search with multiple values]
OR operatorIf any one control is true then it gives a result. [Search with single value]
Power Apps filter collection by logical operator from SharePoint online list

Let me show you how to filter the Power Apps collection by using both logical operators:

Power Apps filter collection by AND operator

Here, we will see how to filter a Power Apps collection by AND operator.

For Example:

I have a SharePoint Online list as ” Loan Approval” that has different columns like:

Column NameData Type
NameTitle
Loan TypeChoice [“Car Loan“, “Gold Loan“, “Home Loan“]
Credit ScoreNumber
Salary Currency
Loan Applied DateDate and time
Approved or NotYes/no
ID ProofImage
Loan Handled byPerson/group
Power Apps Filter Collection using SharePoint List

I created a Power Apps canvas app and added a Dropdown control, a Text-Input control, and a Data table. The dropdown control is connected to the above SharePoint list choice column. When the user selects a value from the drop-down control as “Car Loan” and provides the credit score in a text-input control and clicks on a Search icon.

It evaluates the SharePoint list where it has both data or what. If it is true, it displays a record in the data table based on the controls.

Let’s say, I selected a value as “Car Loan” from the drop-down control and provided a text input as “460” of Credit score. Then click on a search button. Later, it displays the data table based on all the records of the Home Loan, which has a credit score of “460”.

Power Apps filter collection by AND operator from SharePoint list

Let us see how to achieve it:

  • On the Power Apps screen, Insert a Drop-down control -> Set its Items property to:
Choices('Loan Approval'.'Loan Type')
How to filter Power Apps collection by AND operator from SharePoint list
  • Besides a drop-down control, Insert a Text-input control.
Power Apps filter collection by AND operator SharePoint list
  • Insert a Search icon -> Set its OnSelect property to:
ClearCollect(
    coloperator,
    Filter(
        'Loan Approval',
        'Loan Type'.Value = drp_LoanType.Selected.Value && 'Credit Score' = txt_CreditScore.Text
    )
)

Where,

  1. coloperator = Collection Name
  2. Loan Approval = SharePoint list name
  3. Loan Type = SharePoint list column name
  4. drp_LoanType = Drop-down control name
  5. && = AND Operator
  6. Credit Score = Another SharePoint list name.
  7. txt_CreditScore = Text-input control name.
How to filter Power Apps collection by logical operator SharePoint list
  • Insert a Data table -> Set its Items property to:
coloperator
How to filter Power Apps collection by AND operator SharePoint list
  • Save, Publish, and Preview the app. When the users select a value from the drop-down control, provide a text in the Text-input control and click the search icon.
  • Then the data table will filter like if both controls are true then it displays the records based on the controls.
Power Apps filter collection by AND operator SharePoint Online list

This is how we can achieve this by filtering the Power Apps collection by using an AND operator from the SharePoint list.

Power Apps filter collection by OR operator

Here, we will see how to filter collection by OR operator from a SharePoint list.

Example:

I created a blank canvas app and added a Dropdown control, a Text-input control, and a Data table. When the user selects a value from the drop-down control as “Car Loan” and provides the credit score in a text-input control and clicks on a Search icon.

Then the data table will filter like if any one of the controls is true, then it displays the records based on the controls.

Let’s say, I selected a value as “Home Loan” from the drop-down control and provided a text input as “567” of Credit score. Then click on a search button. Later, it displays the data table containing “Home Loan,” but the credit score 567 was not contained.

Power Apps filter collection by OR operator SharePoint list

To achieve it, follow the same above procedures but in the Search icon -> Set its OnSelect property to:

ClearCollect(
    coloperator,
    Filter(
        'Loan Approval',
        'Loan Type'.Value = drp_LoanType.Selected.Value || 'Credit Score' = txt_CreditScore.Text
    )
)

Where,

  1. coloperator = Collection Name
  2. Loan Approval = SharePoint list name
  3. Loan Type = SharePoint list column name
  4. drp_LoanType = Drop-down control name
  5. || = OR Operator
  6. Credit Score = Another SharePoint list name
  7. txt_CreditScore = Text-input control name
How to filter Power Apps collection by OR operator SharePoint list
  • Save, Publish, and Preview the app. When the users select a value from the drop-down control, provide a text in the Text-input control and click the search icon.
  • Then the data table will filter like if any one of the controls is true, then it displays the records based on the controls.
How to filter Power Apps collection by Logical operator from SharePoint list

This is how we can filter the Power Apps collection using the OR operator.

Conclusion

I hope this Power Apps tutorial gave you complete information about filtering the Power Apps collection by a logical operator like And and Or operators.

Also, you may like some more Power Apps tutorials: