Pivot table elements and the Structure view
The pivot table elements (pivot table, hierarchy, fact, and measure) must be organized within the Report Structure view.
A pivot table is constructed from four elements.
- The PIVOTTABLE element represents the table itself and all other elements are contained in it.
- The columns of the table are described by HIERARCHY elements (in case of a dimension column) or MEASURE elements (in case of a value column).
- MEASURE element are grouped in FACT elements.
A static pivot table uses predefined dimensions and measures when creating the report, whereas a dynamic pivot table determines the dimensions and measures at runtime.
![This figure shows a Report Structure where the Pivot Table node has six Dimensions and a Fact element as children. The Fact element contains the four Measures.](Images/elements_of_pivottable.jpg)
This image shows a table with six dimensions (HIERARCHY elements) and four measures (MEASURE elements).
Column definition
This figure shows a pivot table definition on the left and a possible rendering of the table on
the right.
- Dimensions and measures define the columns of the table.
- Not all defined dimensions and measures were selected for display.
- The title of the table and the selection of the dimensions is defined in the pivot table element
- The title of the columns are defined in the dimension and measure elements.
- The selection of the measures is defined in the fact element.
![This figure shows a pivot table report with five columns: two columns map to Dimensions in the Pivot Table element, and three columns map to Measures under the Fact element, which is also a child of the Pivot Table element.](Images/pivot_column_def.jpg)
Row definition
The entity of dimension declaration followed by one fact element forms a row of a table. Typically one row is defined. It is placed in a trigger to get repeated for each input record.
![This figure shows the dimensions and Fact element under the OnEveryRow trigger.](Images/pivot_row_def_1.jpg)
It is allowed, but highly unusual, to specify the rows literally. All rows have to have exactly the same structure (number of dimensions and measures, types, and so on).
![This figure shows the groupings of dimensions and facts into a row.](Images/pivot_row_def_2.jpg)