Table.Max

This function retrieves the maximum row from the table based on the comparison criteria provided. If the table does not contain any rows, it will return the specified default value, if provided.

Syntax

Table.Max(table as table, comparisonCriteria as any, optional default as any) as any

About

This function retrieves the maximum row from the table based on the comparison criteria provided. If the table does not contain any rows, it will return the specified default value, if provided.

Explanation

To identify the row containing the highest value in column [a] within a table, the following steps can be taken. Example 1: Locate the row with the maximum value in column [a] within the table consisting of the entries {[a = 2, b = 4], [a = 6, b = 8]}. Use the function MTable.Max to retrieve this information. Usage: Power Query MTable.Max(     Table.FromRecords({         [a = 2, b = 4],        [a = 6, b = 8]     }),     "a" ) Output: [a = 6, b = 8] Example 2: Identify the row with the maximum value in column [a] within an empty table. In case of an empty table, return -1. Usage: Power Query MTable.Max(#table({"a"}, {}), "a", -1) Output: -1