NBi
NBi copied to clipboard
Support of new reshaping alteration "melt"
This alteration is useful to reshape a result-set into a format where one or more columns are identifier variables, while all other columns, considered measured variables, are “unpivoted” to the row axis, leaving just two non-identifier columns, ‘variable’ and ‘value’.
Attributes:
- variable-identifier: Name to use for the ‘variable’ column. If not specified use ‘variable’.
- value-identifier: Name to use for the ‘value’ column. If not specified use ‘value’.
Elements:
- keys: Column(s) to use as identifier variables.
- values: Column(s) to unpivot. If not specified, uses all columns that are not set as keys.
Original table
Fruit | Price | Stock |
---|---|---|
Apple | 10 | 125 |
Peer | 22 | 145 |
Orange | 5 | 15 |
Alteration
<melt variable-identifier="[attrib.]">
<keys>
<column identifier="#0">
</keys>
<melt />
Result table
Fruit | attrib. | value |
---|---|---|
Apple | Price | 10 |
Apple | Qty | 125 |
Peer | Price | 22 |
Peer | Qty | 145 |
Orange | Price | 5 |
Orange | Qty | 15 |