PowerApps: Lookup vs Filter vs Search Functions
PowerApps makes building robust applications and forms fairly simple. Yet, with any software there’s always a learning curve. As a PowerApps consultant and trainer, the most frequently misunderstood thing I have seen with PowerApps is the difference between the Filter, Lookup and Search functions and when to use each one. Let’s take a look at the difference between these functions:
The LookUp function finds the first record in a table that satisfies a formula. Use LookUp to find a single record that matches one or more criteria.
For example, you have a list of Service Tickets. The Service Ticket list has a Lookup Field to an Employees list of which you can assign a Ticket to. You want to return the Phone # of the employee the selected Service Ticket is Assigned To in your PowerApps Table. This would be a good use case for the LookUp function because you need to return a single record. Here’s how that formula would look:
Lookup(Employees, ServiceTicketsGallery.Selected.AssignedTo.Name = Employees.Name, PhoneNumber)
The Filter function is used to find records in a table that meet formula criteria. This is the equivalent of how you would use the Filter in a SharePoint View or Excel to return multiple records from the list that match one or more criteria and discard those records that don’t.
For example, you have a list called Service Tickets in PowerApps displayed in a Table control. You only want to show Service Tickets that are currently open. You could accomplish this using the following function:
Filter(ServiceTickets, Status = “Open”)
The Search function is different from Filter in that you are finding records that contain a string not that meet a formula.
For example, in our Service Tickets Table in PowerApps we only want to show Service Tickets that have been Assigned To someone with “April” in their name. Here’s how that formula would look:
Hopefully this helps clear up the confusion!