Working with crosstab transformations
You use crosstab transformations to return aggregated data from a selected column across other columns.
About this task
Apply crosstab transformations to display the relations between the values in different columns by transforming one of the columns into a new row. When configuring a crosstab transformation, you define one or a few columns for the side group and one column for the top group. Then, you select an aggregated column to provide values for the newly formed fields in the intersections of top group and side group values.
For example, you have a table with data on production of a number of materials in different regions.
PRODUCT | QTY | REGIONID |
---|---|---|
Plywood | 485 | 1 |
Plywood | 712 | 2 |
Plywood | 787 | 3 |
Lumber | 959 | 1 |
Lumber | 2372 | 2 |
Lumber | 2360 | 3 |
Siding | 1794 | 1 |
Siding | 1940 | 2 |
Siding | 739 | 3 |
Industrial Panels | 1225 | 1 |
Industrial Panels | 627 | 2 |
Industrial Panels | 934 | 3 |
You want to cross-tabulate the QTY
column data so that the aggregated values are
related to the type of product and region number. You select and group the PRODUCT
column as a side group column that will provide the rows and the REGIONID
as a top
group column to provide the columns. The aggregated values of the QTY
column will
be distributed across the fields that are formed by the intersections of the top group and the side
group column values. As a result, you get the following table:
PRODUCT | QTY(1) | QTY(2) | QTY(3) |
---|---|---|---|
Industrial Panels | 1225 | 627 | 934 |
Lumber | 959 | 2372 | 2360 |
Plywood | 485 | 712 | 787 |
Siding | 1794 | 1940 | 739 |
- The selected column must be of the type string, var char, or text.
- Aggregation type should be GROUP.
To configure a crosstab transformation in the analytical query structure: