-
-
Notifications
You must be signed in to change notification settings - Fork 0
Table.TransposeCorrectly
Rodrigo Celso de Lima Porto edited this page Jan 13, 2026
·
1 revision
Transposes a table by converting selected columns (or all columns if none are specified) into rows, promotes headers, and adds a new column containing the original column names. This is useful for restructuring data while preserving column identity.
Table.TransposeCorrectly(
tbl as table,
optional columns as list,
optional firstColumnName as text
) as table-
tbl: The input table whose columns will be transposed. -
columnNames: (optional) A list of column names to transpose. If not provided, all columns in the table will be transposed. -
firstColumnName: (optional) The name to assign to the first column of the transposed table. If not provided, the first name from the columns list will be used.
- The function promotes the first row of the transposed table as headers.
- A new column is added containing the original column names, inserted at the beginning of the table.
- This function is useful for reshaping data, especially when preparing it for pivoting or normalization.
Example 1: Transposing all columns
let
Source = #table(
{"A", "B", "C"}, {
{1, 2, 3},
{4, 5, 6}
}),
Result = Table.TransposeCorrectly(Source)
in
ResultResult
| A | 1 | 4 |
|---|---|---|
| B | 2 | 5 |
| C | 3 | 6 |
Example 2: Transposing only the selected columns
let
Source = #table(
{"A", "B", "C"}, {
{1, 2, 3},
{4, 5, 6}
}),
Result = Table.TransposeCorrectly(Source, {"A", "B"})
in
ResultResult
| A | 1 | 4 |
|---|---|---|
| B | 2 | 5 |
Example 3: Transposing the table and changing the first column name
let
Source = #table(
{"A", "B", "C"}, {
{1, 2, 3},
{4, 5, 6}
}),
Result = Table.TransposeCorrectly(Source, null, "D")
in
ResultResult
| D | 1 | 4 |
|---|---|---|
| B | 2 | 5 |
| C | 3 | 6 |
- 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 πβοΈ