Power Automate Max Function Explained

Power Automate Max Function

The Power Automate Max function lets you find the maximum value within a collection.

Its counterpart is the min function that lets you find the minimum value within a collection.

In this article, I’ll introduce you to the max function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Max Function

power automate max expression
max function in Power Automate

Return the maximum element from a set of numbers or an array.

Syntax

max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])

Input parameters

  • <number1>, <number2>, … (mandatory): The set of numbers from which you desire the largest value.
  • [<number1>, <number2>, …]: The array of numbers from which you desire the largest value..

Return value

  • Returns the largest number in the given set or array.

Power Automate Max Expression Example

max(2,1,7,3,9,4)
=> 9

max(variables('myNumbers')). // myNumbers = [2,1,7,3,9,4]
=> 9

max(createArray(3,0,4,2))
=> 4

How To Use The Power Automate Max Function

Follow the steps to use the Power Automate max function in a flow.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    Power Automate Max Function new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    Power Automate Max Function new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    Power Automate Max Function initialize variable

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name, 2) select type Array, 3) Set value to ‘[2,1,7,3,9,4]’

    Power Automate Max Function setup initialize variable

    Setup variable

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    Power Automate Max Function add compose step

    Add Compose action

  6. Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘max(variables(‘myNumbers’))’, 4) click on ‘OK’

    Power Automate Max Function setup compose step

    Setup max expression in Power Automate

  7. Save and do a test run

    Power Automate Max espression test run result

    Result test run – Power Automate Max function example

Leave a Comment

Your email address will not be published. Required fields are marked *