DB_Table.cross_tab
cross_tabgroup_bynamesvalueson_problems
Group: Calculations
Aliases: pivot, unpivot
Documentation
Returns a new table using a chosen field as the column header and then aggregating the rows within each value as specified. Optionally, a set of fields can be used to group the rows.
Arguments
group_by: Set of fields to group by. If not provided, a single row will be produced.name_column: The field to use as the column header. If this field is not found, then each value will be a single column.values: The aggregation to perform on each set of rows. Can be a single aggregation or a vector of aggregations. Expressions can be used within the aggregation to perform more complicated calculations.on_problems: Specifies how to handle problems if they occur, reporting them as warnings by default.
Examples
Cross Tab Operation
Input Table table:
Id | B | C
----|---------|---------
A | Name | Example
A | Country | France
Result table.cross_tab ['Id'] 'B' (Aggregate_Column.First 'C'):
Id | Name | Country
----|---------|---------
A | Example | France
Errors
- If a column in
group_byorname_columnis not in the input table, aMissing_Input_Columnsis raised as a dataflow error. - If a column selector in
valuesgiven as aTextand it does not match any columns in the input table nor is it a valid expression, anInvalid_Aggregate_Columndataflow error is raised. - If a column name generated from the input data is invalid,
Invalid_Column_Nameserror is raised. - If an aggregation fails, an
Invalid_Aggregationdataflow error is raised. - Additionally, the following problems may be reported according to the
on_problemssetting:- If grouping on, using as the column name, or computing the
Modeon a floating point number, aFloating_Point_Equality. - If when concatenating values there is an quoted delimited,
an
Unquoted_Delimiter - If there are more than 10 issues with a single column,
an
Additional_Warnings.
- If grouping on, using as the column name, or computing the