Max
A
C
D
I
R
S
T
Understanding the Max Function
The Max function is a mathematical function that returns the maximum value from a set of values. It can be used with a single value or an array of values. The syntax for the Max function is as follows:
Max(value1, value2, …)
In this syntax, value1, value2, etc. are the values that you want to find the maximum value from. You can enter up to 254 values in the Max function.
Using the Max Function in Power Apps
Now that you understand the syntax of the Max function, let's take a look at how you can use it in Power Apps. The Max function can be used with various data sources, including tables, collections, and variables.
Using the Max Function with Tables
If you want to find the maximum value in a table, you can use the Max function with the LookUp function. The LookUp function is used to find a record or set of records that match a specific criterion. Here's an example of how to use the Max function with the LookUp function:
Max(LookUp(Table1, RecordID = 1).Value1, LookUp(Table1, RecordID = 2).Value1, LookUp(Table1, RecordID = 3).Value1)
In this example, we're finding the maximum value of the Value1 column in Table1 where the RecordID is equal to 1, 2, or 3.
Using the Max Function with Collections
If you're working with collections, you can use the Max function with the FirstN function. The FirstN function is used to return the first N records from a collection. Here's an example of how to use the Max function with the FirstN function:
Max(FirstN(Collection1, 10).Value1)
In this example, we're finding the maximum value of the Value1 column in the first 10 records of Collection1.
Using the Max Function with Variables
If you're working with variables, you can use the Max function with an array of values. Here's an example of how to use the Max function with an array:
Max([10, 20, 30, 40, 50])
In this example, we're finding the maximum value from the array of values [10, 20, 30, 40, 50].
The Max function is a powerful function that can be used for a variety of purposes in Power Apps. Whether you're working with tables, collections, or variables, the Max function can help you find the maximum value in a set of values. By understanding the syntax of the Max function, you can start using it in your Power Apps projects and take advantage of its power and flexibility.