Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

Find max value in a collection

Hi Everyone,


 I have a table with column Name, Group sequence and Account Sequence. I wanted to find the max value in group sequence and account sequence and set it to 0.


Table 1 :



Table 1 after finding the max value and updating it to zero



Thanks in Advance,





Memorable Member
Memorable Member

Hi @mahmoodhsaud,


You can try below code


Set(getMaxValue,Max(TableName,Column name);



UpdateIf( TableName, columnname=getMaxValue, { ColumnName: 0 } )



Please Mark as answer and give Kudos if its helpful.


Subscribe :

Blog :

Solution Specialist
Solution Specialist



Try below formula for onselect property of button.


FYI, max is not a delegable function, will not work directly with underlying datasource. That is why I have created collection to avoid delegation issue.


ClearCollect(Test2List, 'Test 2S');
UpdateIf('Test 2S', 'Num 1' = Max(Test2List, 'Num 1'), {'Num 1':0},
'Num 2' = Max(Test2List, 'Num 2'), {'Num 2': 0}))


Test 2S is the entity, Num 1 and Num 2 are the columns.


If it answers your question, give kudo and accept it as solution.





Thanks @rampprakash for your valuable inputs, The above formula will work fine for the third column(Account Sequence) whereas in column 2 ( Group Sequence )we will be getting more than one max value based on the column 3

Hello @mahmoodhsaud,


Yes in the first variable we will get he Maximum number (Variable will return which is the Maximum number in the column- only one value 0,1,2,3 the output will be 3) 


Then based on output we will update the records


UpdateIf( TableName, columnname=getMaxValue, { ColumnName: 0 } )


Let me know if it's not helpful.

Please Mark as answer and give Kudos if its helpful.




Subscribe :


Blog :

Hi @rampprakash ,


In the second column, we need to find the max based on third column. In the below table we will be getting two max value in Group Sequence.

The max value in account sequence 1 is 3 and max value in account sequence 2 is 4. Both should be set to 0.






Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,435)