Table.Max Function in Power Query
The Table.Max function returns the largest row from a table using a comparisonCriteria. If the table is empty, the optional default value is returned.
Syntax
Table.Max(table as table, comparisonCriteria as any, optional default as any) as any
Example: Find the row with the largest value in column [Marks] in the table.
Power Query M
let MyTable = Table.FromRecords( { [CustomerID = 1, Name = "Ashish", Marks = 568], [CustomerID = 2, Name = "Katrina", Marks = 855], [CustomerID = 3, Name = "Alia", Marks = 380], [CustomerID = 4, Name = "Vicky", Marks = 458], [CustomerID = 5, Name = "Mohini", Marks = 278], [CustomerID = 6, Name = "Meenakshi", Marks = 289], [CustomerID = 7, Name = "Esha", Marks = 875], [CustomerID = 8, Name = "Anjali", Marks = 380] } ), Return = Table.Max(MyTable, "Marks") in Return
The output of the above formula is shown below: