OpenBI Docs Buy

CORREL OpenBI

The correlation between two expressions over a table's rows (Pearson's); BLANK for fewer than two rows or no variation.

Group: Statistics. OpenBI’s own: DAX has no function of this name.

Syntax

CORREL ( <table>, <x>, <y> )
ParameterTypeDescription
tableTableThe rows to go through.
xExpression
evaluated for each row
The first number, worked out for each row.
yExpression
evaluated for each row
The second number, worked out for each row.

Returns

Number. The Pearson correlation coefficient between x and y, from −1 to 1.

Remarks

  • Only rows where both x and y have a value count; a row with a blank in either is left out.
  • With fewer than two such rows, or when x or y is the same on every row, the result is BLANK.
  • Text is an error; dates count as their serial numbers.
  • It measures how well a straight line fits. For a relation that rises steadily but bends, CORREL.SPEARMAN says more.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

In Power BI the same coefficient takes a measure written out from sums of products and squares.

Examples

Warmer days, more beer

EVALUATE
VAR Days =
    DATATABLE (
        "Temperature", INTEGER, "Liters", INTEGER,
        { { 8, 380 }, { 12, 410 }, { 15, 470 }, { 19, 455 }, { 23, 590 }, { 26, 610 } }
    )
RETURN
    ROW ( "Correlation", CORREL ( Days, [Temperature], [Liters] ) )
Correlation
0.950661297911026

Population and GDP by continent

A continent with a single country has no correlation.

EVALUATE
SUMMARIZECOLUMNS (
    Countries[Continent],
    "Countries", COUNTROWS ( Countries ),
    "Correlation", CORREL ( Countries, Countries[People], Countries[GDP] )
)
ORDER BY Countries[Continent]
Countries[Continent]CountriesCorrelation
Africa510.820871122295425
Asia470.781768427189445
Europe390.792967830668549
North America180.950765041991018
Oceania70.948472070437285
Seven seas (open ocean)1(blank)
South America130.983989902077897

CORREL.SPEARMAN, LINESTX, TRENDLINE, STDEVX.S.

Last updated · OpenBI Studio 0.3.74