The MAXX function returns the maximum value taken by an expression that is evaluated for all rows in a table.
MAXX(
table,
expression
)
- table: Table containing the rows for which the expression will be evaluated.
- expression: Expression to evaluate for each row of the table.
The MAXX function returns a real number, a datetime value, or a text string.
The function evaluates the expression included as the second argument for each of the rows of the indicated table, returning the highest value found. Only numerical values, dates and texts are considered.
The table argument can be either a table or a function that returns a table.
Suppose we have the following table showing the sales list, including the number of items sold and their unit price:
We can extract the highest selling price with the following measure:
Precio máximo = MAXX(Ventas, Ventas[Precio])
...obtaining the following result (taken to a card type display):
In the previous scenario, we could calculate the maximum sale amount (understood as the product of the unit price and the number of units involved in the sale) with the following measure:
Importe máximo = MAXX(Ventas, Ventas[Precio] * Ventas[Cantidad])
In this case, the function will evaluate the product of the sale price and the quantity for each row in the table and return the largest value: