Skip to main content
Community site session details

Community site session details

Session Id : piD3ix0G4h8SBINM2H+Tnp
Power Apps - Building Power Apps
Answered

Find the MAX in collection, and assign values to another variable

Like (0) ShareShare
ReportReport
Posted on 23 Aug 2023 14:54:04 by Microsoft Employee

I have an SPO List.

I am grabbing this list and putting it in a variable......var_MaxList

There is column called case load.

I want to find the MAX number there and return the entire line into another variable.

So basically, go through the entire collection, find the engineer with the MOST number of cases, and return that to a variable.

Then with that variable I can pull out the different values from SPO.

The other piece is there is a chance that two or more people will have the same amount, so MAX could return three different lines.

I just want it to return the first one found.

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 23 Aug 2023 at 15:30:59
    Re: Find the MAX in collection, and assign values to another variable

    Hi @lardo5150 ,

     

    Edit: Good to see you get this sorted 🙂

  • lardo5150 Profile Picture
    Microsoft Employee on 23 Aug 2023 at 15:30:05
    Re: Find the MAX in collection, and assign values to another variable

    I had to use Value(SUMCases) (that is my SPO calculated column) instead of just SUMCases.

    Thanks!

  • lardo5150 Profile Picture
    Microsoft Employee on 23 Aug 2023 at 15:24:10
    Re: Find the MAX in collection, and assign values to another variable

    It is a calcualted column if that makes a difference.

    It is adding two other columns in SPO.

    It is returning something right in the middle (9), when I have someone with 30.

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 23 Aug 2023 at 15:22:23
    Re: Find the MAX in collection, and assign values to another variable

    Hi @lardo5150 ,

     

    Can you please share the results? Perhaps the column type is a text, not a number?

  • lardo5150 Profile Picture
    Microsoft Employee on 23 Aug 2023 at 15:17:56
    Re: Find the MAX in collection, and assign values to another variable

    Seems to be returning something right in the middle, not the max for some reason.

  • Verified answer
    BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 23 Aug 2023 at 14:57:12
    Re: Find the MAX in collection, and assign values to another variable

    Hi @lardo5150 ,

     

    By sorting the collection by the amount and then taking the first item, you can get the required result:

     

    Set(
    	gblMax,
    	First(
    		Sort(
    			Collection,
    			AmountColumn,
    			SortOrder.Descending
    		)
    	)
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete