Divooka Reference

Table Reshaping

3 nodes

On this page 3

Pivot

Function

A pivot table: a row per value of the Rows columns, a column per value of the Pivot column, and in each cell the Value column of the rows that fall there, summarized - the sales of each region by month, say.

Signature
Pivot -> Table
    table: Table
    rows: Text Array
    pivot: Text
    value: Text
    aggregation: Aggregation
    fill: Text
Table Pivot(
    Table table,
    string[] rows,
    string pivot,
    string value,
    Aggregation aggregation = Aggregation.Sum,
    string fill = "")

Parameters

nametypedefaultdescription
tableTable—The rows to pivot.
rowsText Array—The columns whose values make the rows.
pivotText—The column whose values become the new columns.
valueText—The column whose values fill the cells.
aggregationAggregationSumHow the values that fall in one cell become one.
fillText—What an empty cell holds; empty to leave it empty.

Returns

TableTable

Remarks

The new columns are in natural order of their values, and there can be at most 500 of them. A cell no row falls in is empty, or Fill when it is given.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Table Reshaping
Package
Data Analytics

Transpose

Function

Rows turned into columns and columns into rows. The first column of the result holds the original column names; the new columns are named from the Header column's values, or "Row 1", "Row 2" and so on. At most 1,000 rows.

Signature
Transpose(table: Table, header: Text) -> Table
Table Transpose(Table table, string header = "")

Parameters

nametypedefaultdescription
tableTable—The table to transpose.
headerText—A column whose values name the new columns; empty to number them.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Table Reshaping
Package
Data Analytics

Unpivot

Function

Columns turned into rows - the opposite of a pivot, also called melt: each row becomes one row per value column, holding the ID columns, the value column's name and its value.

Signature
Unpivot -> Table
    table: Table
    IDs: Text Array
    values: Text Array
    nameColumn: Text
    valueColumn: Text
    skipEmpty: Truth
Table Unpivot(
    Table table,
    string[] ids,
    string[] values,
    string nameColumn = "Attribute",
    string valueColumn = "Value",
    bool skipEmpty = true)

Parameters

nametypedefaultdescription
tableTable—The wide table.
IDsText Array—The columns to keep on every row.
valuesText Array—The columns to turn into rows; every column but the IDs when empty.
nameColumnTextAttributeThe name of the column that says which column a value came from.
valueColumnTextValueThe name of the column the values go in.
skipEmptyTruthTrueWhether to leave out rows whose value is empty.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Table Reshaping
Package
Data Analytics