Daily DAX : Day 344 MAXX
DAX MAXX Function
The MAXX
function in Power BI's Data Analysis Expressions (DAX) evaluates an expression for each row in a table and returns the maximum value of that expression.
Syntax
MAXX(<table>, <expression>)
- <table>: The table to iterate over.
- <expression>: The expression to evaluate for each row, returning a scalar value.
Return Value
The maximum value of the expression across all rows in the specified table.
Use Case
MAXX
is useful when you need to find the maximum value of a calculated expression across rows in a table, such as finding the highest sales amount after applying a discount or the latest date in a dataset.
Example
Suppose you have a table Sales
with columns Product
, Quantity
, and UnitPrice
. You want to find the maximum revenue (Quantity * UnitPrice) for any product.
MaxRevenue = MAXX(Sales, Sales[Quantity] * Sales[UnitPrice])
This measure iterates over each row in the Sales
table, calculates the revenue for each product, and returns the highest revenue value.
Notes
MAXX
evaluates the expression for each row, so ensure the expression is valid for the table's context.- It differs from
MAX
, which works on a single column without evaluating an expression. - Use in measures or calculated columns for dynamic analysis in Power BI reports.
Comments
Post a Comment