OpenBI Docs Buy

MAXX

The largest value of an expression over a table's rows; with TRUE as a third argument, text and numbers compare as ORDER BY sorts them.

Group: Aggregation. Compatible with DAX.

Syntax

MAXX ( <table>, <expression> [, <variant>] )
ParameterTypeDescription
tableTableThe rows to go through.
expressionExpression
evaluated for each row
The value worked out for each row: a number, a date or text.
variantBoolean
optional
TRUE to allow results of different types, numbers and texts, compared in the order a sort puts them; FALSE or left out to keep to one type.

Returns

Same type as its results. The largest of the expression's results, blanks left out.

Remarks

  • Over an empty table, or when every result is blank, the answer is BLANK.
  • Text is compared without regard to case.
  • MAXX ( VALUES ( Products[Product] ), [Revenue] ) is the revenue of the best-selling product; to know which product that is, use TOPN.

Examples

The largest order line

EVALUATE
VAR Orders =
    DATATABLE (
        "Product", STRING, "Liters", INTEGER, "Price", DOUBLE,
        { { "Pils", 120, 38 }, { "IPA", 80, 64 }, { "Cider", BLANK (), 52 }, { "Stout", 45, 70 } }
    )
RETURN
    ROW ( "Largest line", MAXX ( Orders, [Liters] * [Price] ) )
Largest line
5120

The best product's revenue

EVALUATE
ROW ( "Best revenue", MAXX ( VALUES ( Products[Product] ), [Revenue] ) )
Best revenue
38164388

MAX, MINX, TOPN, SUMX.

Last updated · OpenBI Studio 0.3.74