How to Get the Largest Value in Power Apps with Max
Max returns the largest of its numbers. Give it a list of values, or a table and a column, and it hands back the biggest. Beyond the obvious uses, like the latest score or the highest amount, it's handy for layouts: "make this as tall as whichever of these is tallest".
Syntax
Max( Number1 [, Number2, ... ] )
Max( Table, NumericalFormula )
Microsoft's aggregate functions reference notes that these functions operate on numbers only; other types, such as text, are ignored. Min works the same way for the smallest value.
Prerequisites
- A canvas app with a Text control to try formulas in. The example is the Career Development Plan app, from Part 4 of the series.
Step 1: The Largest of Two Numbers
Max(72, 114)

Step 2: Use It for a Layout
In the example, a profile row holds a 72-pixel avatar next to three lines of text that can wrap on a phone. The row has to be as tall as whichever is taller:
Max(
avtMeHS.Height,
lblWelcomeHS.Height + lblJobTitleHS.Height + lblManagerHS.Height + 2 * conProfileTextHS.LayoutGap
)
On a wide screen the text needs 114 pixels, so the row is 114. On a phone the text wraps, the Text controls grow (their Auto height is on), and the row grows with them. Fixed: Text Is Cut Off Inside a Container on Small Screens in Power Apps explains why this was needed.
Step 3: The Largest Value in a Table
With a table and a column:
Max( Sales, CostPerUnit * UnitsSold )
The formula is worked out for each row, and the largest result returned. With a data source such as SharePoint, check whether Max can be delegated, or it only sees the rows downloaded.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Passing text numbers, such as "5" | Text is ignored | Convert with Value first |
| Using Max on a big list without checking delegation | Only downloaded rows are considered | Check the delegation warning |
| Expecting the row back | Max returns the number, not the record | Use Sort and First to get the row |
FAQ
What about the smallest value?
Min, with the same syntax.
Can Max compare dates?
Microsoft describes these functions as numeric. For dates, sort the table instead and take the first row.
What if every value is blank?
There's nothing numeric to compare. Guard the inputs with Coalesce if blanks are possible.
Conclusion
Max(a, b, …) or Max(table, formula) returns the largest number. In layouts, it's a neat way to size a container to its tallest content.
Additional Resources
- Average, Max, Min, StdevP, Sum, and VarP functions: syntax and delegation notes.
