#PowerPlatformTip 64: 'Comparing Lookup vs. First(Filter)'
TL;DR:
LookUp(Source, Condition)andFirst(Filter(Source, Condition))return the same first matching record when the match is unique or the order is defined (with several matches, which record comes “first” depends on the data source’s order, so sort explicitly if it matters).Filter,FirstandLookUpare all on the delegable list, but whether your whole formula delegates depends on your data source and columns, so check for delegation warnings. Pick one pattern for consistency, and know the real differences:LookUp()can return a single value with its third argument, andFirst(Sort(Filter(...)))states the sort order openly, whileLookUp()has no sort argument of its own.
💡 Challenge
In Power Apps, when you need to retrieve the first record that meets certain criteria, you have two options, LookUp() and First(Filter()), which can cause confusion over which to use.
✅ Solution
Pick one consistent pattern. Using First(Filter(Source, Condition)) throughout keeps your code simple and uniform, and it extends naturally when you need sorting. Use LookUp() where its third argument saves you a step.
🔧 How It’s Done
1. Identify your criteria
🔸 Determine the data source (Source) and the filter condition.
🔸 Write Filter(Source, Condition) to narrow down records.
2. Retrieve the first match
🔸 Wrap the filter in First():
First( Filter( Source, Condition ) )
🔸 It returns the same record as:
LookUp( Source, Condition )
🔸 Both return Blank() if nothing matches.
3. Know where they differ
🔸 “The latest” or “the highest”: LookUp() has no sort argument, so without a defined order it returns whichever matching record comes first. To get the most recent matching record, sort before you take the first one (you can also pass a sorted table to LookUp(), but check delegation then). If two records can share the same Created value, add a second sort column so the result is unique:
First( Sort( Filter( Orders, Customer = "Contoso" ), Created, SortOrder.Descending ) )
🔸 Several conditions: Filter() takes several conditions as separate arguments, Filter(Orders, Status = "Open", Amount > 100). In LookUp() you combine them with &&.
🔸 A single value: LookUp(Source, Condition, Column) returns the value directly, see Tip 63.
4. Standardize across your app
🔸 Decide on one pattern for “first matching record” and use it in every screen.
🔸 Maintaining a single pattern improves readability and eases future updates.
🎉 Result
You now have a uniform approach to fetching the first matching record, making your Power Apps formulas more consistent and easier to read. Filter, First and LookUp are all on the list of delegable functions (Delegable functions), so the choice between the two patterns doesn’t by itself force a local scan. Whether the complete formula delegates still depends on your data source and the columns and operators you use, so check each formula for delegation warnings and test it on your data source.
🌟 Key Advantages
🔸 Consistent coding pattern throughout your app
🔸 Improved readability and maintainability
🔸 Delegable either way, as long as the condition itself is delegable for your data source
🔸 First(Filter()) grows into First(Sort(Filter())) without rewriting
🎥 Video Tutorial
🛠️ FAQ
1. What’s the difference between LookUp() and First(Filter())?
Both return the first record that matches the condition, or Blank() if none does. LookUp() can also evaluate a formula on that record (third argument), First(Filter()) can be combined with Sort() to make the order explicit (with several matches, neither form guarantees which record comes first unless the order is defined).
2. When might I still use LookUp()?
When you only need one column or a calculated value from the match, LookUp(Source, Condition, Column) is shorter. Tip 63 shows the variants.
3. Does switching to First(Filter()) impact delegation?
Not by itself, but check it for your data source. Filter, First and LookUp are delegable functions, and delegation of the complete formula depends on the data source and the condition (and on a Sort if you add one): if it uses a non-delegable function for your data source, both forms only look at the first records up to the Data row limit, and Power Apps shows a delegation warning.
🔗 Related Tips
🔸 #PowerPlatformTip 63: ‘Mastering the Lookup Function’ - the direct-column Lookup(Source, Condition, COLUMN) syntax worth knowing before you standardize on one pattern.
🔸 #PowerPlatformTip 23: ‘Filter Blank’ - a common addition to the Filter() half of First(Filter()).
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).