Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
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,096 Super User 2025 Season 1 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,096 Super User 2025 Season 1 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,096 Super User 2025 Season 1 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 250 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 122

#3
stampcoin Profile Picture

stampcoin 108

Overall leaderboard
Loading started