transformations:unpivot
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| transformations:unpivot [2018/10/03 15:18] – dmitry | transformations:unpivot [2025/01/17 01:18] (current) – revise to 2025 format craigt | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Unpivot | + | {{ transformations: |
| + | ====== | ||
| + | Category: Transform / Advanced\\ | ||
| - | Converts a matrix table into a straight table by rotating columns into [Labels] and [Data] columns. This transformation | + | \\ |
| + | =====Description===== | ||
| + | Converts a matrix table into a straight table by rotating columns into "Labels" | ||
| - | EXAMPLE | + | \\ |
| + | =====Use cases===== | ||
| + | This action is used to convert a cross-table (or matrix) into a straight table. It can be used, for instance, to convert a cross-table from an Excel spreadsheet into a table suitable for exporting into a database. | ||
| - | **Table:** Winter Olympics medals | + | \\ |
| + | =====Action settings===== | ||
| + | ^Setting^Description^ | ||
| + | |Column name for labels|Enter a name for the column that will contain the column header labels from the matrix table. | ||
| + | |Column name for data|Enter a name for the column that will contain the data values from the matrix table. | ||
| + | |Unpivot all columns except these|Select fields that will not be unpivoted, but instead will be repeated down rows, as is, once for each column heading in the matrix table. | ||
| - | ^ Country | + | \\ |
| - | | Canada | + | =====Remarks===== |
| - | | United States | + | Typically, any columns used for row labels in the source matrix table will be selected under " |
| - | | Norway | + | |
| - | | Germany | + | |
| - | **Transformation: | + | \\ |
| + | =====Examples===== | ||
| + | ====Example #1==== | ||
| + | >Convert the matrix table, below, into a standard data table. | ||
| - | **Result:** | + | ===Before (source table)=== |
| + | Table 1: Winter Olympics medals | ||
| + | ^Country | ||
| + | | Canada | ||
| + | | Norway | ||
| + | | Germany | ||
| - | ^ Country | + | ===After (result table)=== |
| - | | Canada | + | ^Country |
| - | | United States | + | | **Canada** |**Winter |
| - | | Norway | + | | **Norway** |**Winter |
| - | | Germany | + | | **Germany** |**Winter |
| - | | Canada | + | | **Canada** |**Winter |
| - | | United States | + | | **Norway** |**Winter |
| - | | Norway | + | | **Germany** |**Winter |
| - | | Germany | + | |
| - | **See also** | + | ===Action parameters=== |
| + | > Column name for labels: Labels | ||
| + | > Column name for data: Data | ||
| + | > Unpivot all columns except these: Country | ||
| + | |||
| + | \\ | ||
| + | ====Example #2==== | ||
| + | >Convert the matrix table, below, into a standard data table.\\ | ||
| + | |||
| + | ===Before (source table)=== | ||
| + | Table 1: Winter Olympics medals | ||
| + | ^Country | ||
| + | | Canada | ||
| + | | Norway | ||
| + | | Germany | ||
| + | |||
| + | ===After (result table)=== | ||
| + | ^Labels | ||
| + | |**Country** | ||
| + | |**Country** | ||
| + | |**Country** | ||
| + | |**Winter 2010** | ||
| + | |**Winter 2010** | ||
| + | |**Winter 2010** | ||
| + | |**Winter 2014** | ||
| + | |**Winter 2014** | ||
| + | |**Winter 2014** | ||
| + | |||
| + | ===Action parameters=== | ||
| + | > Column name for labels: Labels | ||
| + | > Column name for data: Data | ||
| + | |||
| + | \\ | ||
| + | =====Community examples===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | \\ | ||
| + | =====See also===== | ||
| * [[transformations: | * [[transformations: | ||
| + | |||
transformations/unpivot.1538594317.txt.gz · Last modified: by dmitry