-
-
Notifications
You must be signed in to change notification settings - Fork 0
Table.CorrelationMatrix
Rodrigo Celso de Lima Porto edited this page Jan 13, 2026
·
1 revision
Calculates the correlation matrix for a given table. It computes the Pearson correlation coefficient between each pair of numeric columns, returning a table where each cell represents the correlation between two variables.
Table.CorrelationMatrix(
tbl as table,
optional columnNames as type {text}
) as table-
tbl: The input table containing numeric columns to be analyzed. -
columnNames(optional): A list of column names to include in the correlation matrix. If not provided, all numeric columns in the table will be used.
The result is a symmetric matrix with correlation values ranging from -1 to 1. The output table includes a "VARIABLE" column indicating the row variable, followed by columns representing correlations with other variables.
- The function uses the Pearson correlation formula to measure linear relationships between columns.
- Nulls, empty strings, and non-numeric values are treated as 0 during computation.
Example 1: Correlation matrix for all numeric columns.
let
Source = #table(
{"A", "B", "C"}, {
{1, 2, 3},
{2, 4, 6},
{3, 6, 9}
}),
Result = Table.CorrelationMatrix(Source)
in
ResultResult
| VARIABLE | A | B | C |
|---|---|---|---|
| A | 1.0 | 1.0 | 1.0 |
| B | 1.0 | 1.0 | 1.0 |
| C | 1.0 | 1.0 | 1.0 |
Example 2: Correlation matrix for selected columns.
let
Source = #table(
{"X", "Y", "Z"}, {
{1, 10, 100},
{2, 20, 80},
{3, 30, 60},
{4, 40, 40}
}),
Result = Table.CorrelationMatrix(Source, {"X", "Z"})
in
ResultResult
| VARIABLE | X | Z |
|---|---|---|
| X | 1.0 | -1.0 |
| Z | -1.0 | 1.0 |
- Binary.Unzip πβοΈ
- DateTime.ToUnixTime πβοΈ
- Decision.EntropyWeights πβοΈ
- Decision.TOPSIS πβοΈ
- List.Correlation πβοΈ
- List.Intercept πβοΈ
- List.Outliers πβοΈ
- List.PopulationStdDev πβοΈ
- List.Primes πβοΈ
- List.Rank πβοΈ
- List.Slope πβοΈ
- List.Variance πβοΈ
- List.WeightedAverage πβοΈ
- Number.FromRoman πβοΈ
- Number.IsInteger πβοΈ
- Number.IsPrime πβοΈ
- Number.ToRoman πβοΈ
- Statistical.NormDist πβοΈ
- Statistical.NormInv πβοΈ
- Table.AddColumnFromList πβοΈ
- Table.CorrelationMatrix πβοΈ
- Table.NormalizeColumnNames πβοΈ
- Table.NormalizeTextColumns πβοΈ
- Table.RemoveBlankColumns πβοΈ
- Table.TransposeCorrectly πβοΈ
- Text.CountChar πβοΈ
- Text.ExtractNumbers πβοΈ
- Text.HtmlToPlainText πβοΈ
- Text.RegexExtract πβοΈ
- Text.RegexReplace πβοΈ
- Text.RegexSplit πβοΈ
- Text.RegexTest πβοΈ
- Text.RemoveAccents πβοΈ
- Text.RemoveDoubleSpaces πβοΈ
- Text.RemoveLetters πβοΈ
- Text.RemoveNumerals πβοΈ
- Text.RemovePunctuations πβοΈ
- Text.RemoveStopwords πβοΈ
- Text.RemoveWeirdChars πβοΈ
- AreArraysEquals πβοΈ
- AutoFillFormulas πβοΈ
- CleanString πβοΈ
- DisableRefreshAll πβοΈ
- EnableRefreshAll πβοΈ
- FileExists πβοΈ
- FileNameIsValid πβοΈ
- GetAllFileNames πβοΈ
- GetLetters πβοΈ
- GetMonthNumberFromName πβοΈ
- GetStringBetween πβοΈ
- GetStringWithSubstringInArray πβοΈ
- GetTableColumnNames πβοΈ
- IsAllTrue πβοΈ
- IsInArray πβοΈ
- ListObjectExists πβοΈ
- PreviousMonthNumber πβοΈ
- RangeHasAnyFormula πβοΈ
- RangeHasConstantValues πβοΈ
- RangeIsHidden πβοΈ
- RangeToHtml πβοΈ
- SendEmail πβοΈ
- SetQueryFormula πβοΈ
- StringContains πβοΈ
- StringEndsWith πβοΈ
- StringStartsWith πβοΈ
- SubstringIsInArray πβοΈ
- Summation πβοΈ
- TableHasQuery πβοΈ
- WorksheetHasListObject πβοΈ