MEDIANX

The MEDIANX function returns the median of the values taken by an expression that is evaluated for all the rows in a table.

Syntax

MEDIANX(
    table,
    expression
)

Parameters
  • table: Table containing the rows for which the expression is evaluated.
  • expression: Expression to evaluate for each row of the table.
Returned value

The MEDIANX function returns a real number.

Additional Information

To calculate the median of the values of a column it is preferable to use the MEDIAN function.

Examples

Suppose we have in the Sales table the SalesAmount and TotalProductCoste fields containing the sales price and the total manufacturing cost. If we want to calculate the median profit, we can define the following measure:

Profit median = MEDIANX(Sales, Sales[SalesAmount] - Sales[TotalProductCost])

If we take this measure to a table disaggregated by product category, we obtain the following result:

MEDIANX function. Example of use
Related functions
Category
Statistical
Submitted by admin on Sat, 12/29/2018 - 19:53