Downloads
DAXAggregationIntermediate

MAXX

Evaluates an expression on each row of a table and returns the largest result.

Syntax
MAXX(<table>, <expression>)

Returns: A value (a scalar). BLANK when there are no values in the table.

What it does

MAXX is MAX for calculations. It walks a table, calculates the expression on each row, and returns the largest result. It answers questions such as "which customer has the largest balance" or "which store has the highest sales per square metre," where the value to compare is worked out, not stored.

Syntax and arguments

Example

The sales VP wants the single best product by gross margin amount in the selected period.

Best Product Margin =
MAXX(
    VALUES(Product[ProductName]),
    [Gross Margin]
)

Each product's gross margin is calculated in its own context, and the largest value is returned. A companion measure that returns the name of the product with the highest value is the usual next step in a dashboard.

Example: a second, different use

The largest single sales line in the period, for a large transaction review:

Largest Line =
MAXX(
    Sales,
    Sales[SalesAmount]
)

This gives the same answer as MAX(Sales[SalesAmount]). It becomes useful when the expression is a calculation, such as quantity times price on each line.

Things to watch

In business terms

MAXX finds the top customer, product, branch or project by any calculated measure. Finance teams use it for the biggest exposure in a credit file, the highest cost center overrun and the best performing channel.

Related functions

All DAX functions · View as Markdown · DAX fundamentals