GEOMEANX
The geometric mean of an expression over a table's rows.
Group: Statistics. Compatible with DAX.
Syntax
GEOMEANX ( <table>, <expression> )
| Parameter | Type | Description |
|---|---|---|
table | Table | The rows to go through. |
expression | Expression evaluated for each row | The number worked out for each row. |
Returns
Number. The geometric mean of the expression's results, blanks left out.
Remarks
- Its common use is the mean growth rate: GEOMEANX ( table, 1 + [Return] ) − 1.
- Blank results are left out; a zero result makes the answer 0.
- Negative results are taken as an odd root takes them; with an even number of results whose product is negative, the answer is NaN.
- Text, dates and TRUE/FALSE are errors. Over an empty table the result is BLANK.
Examples
Mean yearly return over three years
EVALUATE
VAR Returns =
DATATABLE (
"Year", INTEGER, "Return", DOUBLE,
{ { 2023, 0.12 }, { 2024, -0.05 }, { 2025, 0.08 } }
)
RETURN
ROW ( "Mean yearly return", GEOMEANX ( Returns, 1 + [Return] ) - 1 )
| Mean yearly return |
|---|
| 0.047422248222325 |
Lower than the arithmetic mean
EVALUATE
VAR Growth = DATATABLE ( "Factor", DOUBLE, { { 1.10 }, { 0.95 }, { 1.20 } } )
RETURN
ROW (
"Geometric", GEOMEANX ( Growth, [Factor] ),
"Arithmetic", AVERAGEX ( Growth, [Factor] )
)
| Geometric | Arithmetic |
|---|---|
| 1.07836515339094 | 1.08333333333333 |
Blanks, zeros and negatives
EVALUATE
ROW (
"With a blank", GEOMEANX ( DATATABLE ( "v", DOUBLE, { { 2 }, { BLANK () }, { 8 } } ), [v] ),
"With a zero", GEOMEANX ( DATATABLE ( "v", DOUBLE, { { 2 }, { 0 }, { 8 } } ), [v] ),
"One negative", GEOMEANX ( DATATABLE ( "v", DOUBLE, { { 2.5 }, { 3.5 }, { -1 } } ), [v] )
)
| With a blank | With a zero | One negative |
|---|---|---|
| 4 | 0 | -2.06064264990428 |