Microsoft Flow – Find Min or Max Value

ByHariharan Rajendran

Microsoft Flow – Find Min or Max Value

This post explains the steps that you need to perform to find the minimum or maximum value from a list of values or a field from a table in Microsoft flow

I am explaining a simple procedure to achieve the result.

Procedure:

1.       Take the first number and store it on a variable

2.       Compare that variable to all the values from the field

3.       Check the Maximum (greater than) value – If else condition

Scenario:

I am taking google sheet which has the column called “Sales”. It has some value. I need to find the maximum value.

Follow the below steps in Microsoft flow

Step 1 – Use any trigger

Step 2 – Action – “Get Rows – Google Sheet” and select the appropriate sheet.

Step 3 – Action – “Select”

        From : “Record value”

        Map : “Sales” => Sales

Step 4- Action – “Initialize Variable”

        Name : “MaximumSales”

        Type: “Integer”

        Value: int(first(body(‘Select’))?[‘Sales’])

Step 5 – Action – “Apply to each “

         Select an output from previous steps: Records value

        Condition

                                                               i.      int(items(‘Apply_to_each’)?[‘Sales’]) “is greater than” “MaximumSales”

                                                             ii.      If Yes

        Set Variable

               Name: MaximumSales

               Value: int(items(‘Apply_to_each’)?[‘Sales’])

Step 6 – Action – “Compose”

       Inputs : MaximumSales

That’s it. we got the maximum value. Stay tuned for the use case with this logic.

About the Author

Hariharan Rajendran author

Hariharan Rajendran is a Microsoft Certified Trainer with 9+ years of experience in Database, BI and Azure platforms. Hariharan is also an active community leader, speaker & organizer and leads the Microsoft PUG (Power BI User Group – Chennai), SQLPASS Power BI Local Group – Chennai and an active speaker in SQL Server Chennai User Group and also a leader in Data Awareness Program worldwide events. Hariharan also frequently blogs (www.dataap.org/blog), provides virtual training (on ad-hoc basis) on Microsoft Azure, Database Administration, Power BI and database development to worldwide clients/audience.

Leave a Reply