You are here: Calculators > AttributePivoter

AttributePivoter

Restructures and regroups incoming features based on specified “Group by attributes” and calculates summary statistics based on a designated “Attribute To Analyze” in order to form a Pivot table output.

Like its cousin, the StatisticsCalculator, the AttributePivoter groups features according to selected attributes, and computes statistics on a single attribute for all features in each group (Grouping by rows). Beyond this, the AttributePivoter allows for the order of these row grouping attributes to be specified so that a logical nesting of additional summary rows can be generated. In addition, the AttributePivoter also allows for new attributes to be generated dynamically based on the unique values of a selected attribute (Grouping by Column) with values populated by statistics performed on the resultant groupings.

Note: Note: Because the AttributePivoter generates attributes dynamically, you must set any writer feature types to dynamic mode if you want to include these attribute in the output. This is described in more detail in Result Grouping and Tabular Structure.

Input Ports

Output Ports

Parameters

Result Grouping and Tabular Structure

Input features are grouped by “grouping attributes”, and statistics are computed on the specified analyzed attribute in each group. There are two kinds of grouping attributes which work together to define these groups:

  • Row Grouping Attributes: The user specifies an ordered set of attributes that divide the statistics into rows. There is a single row of result data for each unique set of values for the specified set of row grouping attributes.
  • Column Grouping Attribute: The user can optionally specify a single attribute to define columns in the resulting rows. If specified, each unique value of the column grouping attribute contributes a column of statistical data to the result, for each statistic being computed. Additionally, if there is more than one unique value for the column, a summary column will be generated for each statistic.

    If no column grouping attribute is selected, each row will contain a single computed result for each selected output statistic.

Because the row grouping attributes are ordered, they effect a sort of logical nesting of groups. At the lowest level, a complete set of unique values is represented as a single row of the result. One level up is the logical grouping consisting of the set of rows where all row grouping attributes are unique except for the last one specified. This logical nesting carries up to the first specified row grouping attributes.

A row resulting from a complete set of unique data values is known as a “data row”. There is an additional “summary row” generated for each logically nested grouping, which summarizes the data for the data rows contained in the grouping.

The sequence of resulting rows form a table with the following attributes:

  1. All of the row grouping attributes, whose combined values specify the actual group
  2. For each pivot summary type, an attribute with the corresponding statistic, computed over all features in the row group.
  3. If there was more than a single column group defined, each of the attributes in (2.) will be repeated for all column groups, along with a summary value (i.e. a “grand total”) computed over the attribute values over all column groups. The method for computing the summary value depends on the statistic it is representing:
    • Count and Sum statistics are summarized with the sum of the computed statistics for the row group.
    • Average statistics are summarized with the average of all values in the row group.
    • Min values are summarized by the minimum of all occurrences of the analyzed attribute for the group.
    • Max values are summarized by the maximum of all occurrences of the analyzed attribute for the group.

The first data feature and first summary feature emitted will contain additional attributes which will contain the schema information needed to write the data out to a feature type configured for dynamic writing.

Example

Editing Transformer Parameters

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.

Transformer Categories

Calculators

Search FME Knowledge Center

Search for samples and information about this transformer on the FME Knowledge Center.