Aggregation
Pivot aggregation
Each Pivot group can be aggregated — that is, transformed into a new value, DataRow, or DataFrame — and then concatenated into a single DataRow composed of these aggregated results, with pivot keys as top-level columns or as column groups.
The following aggregation methods are available:
frames— returns thisPivotas aDataRowwith pivot keys as columns (orcolumn groups) and corresponding groups stored asFrameColumns;values— creates aDataRowcontaining values collected into a singleListfrom all rows of each group for the selected columns (values fromcolumn groupsare collected into aDataFrame);count— creates aDataRowcontaining the pivot key columns and an additional column with the number of rows in each corresponding group;with— creates aDataRowcontaining values computed using aRowExpressionacross all rows of each group. Values of theDataRowtype are collected into aDataFrame, and the resulting column is aFrameColumn. Values of other types are collected into aList, and the resulting column is aDataColumnofList;aggregate— performs a set of custom aggregations usingAggregateDsl, allowing computation of one or more derived values per group;Various aggregation statistics— predefined shortcuts for common statistical aggregations such assum,mean,median, and others.
Each of these methods returns a new DataRow with pivot keys as top-level columns (or as column groups) and values representing the aggregated results of each group.
Check out .Pivot grammar
For more information: See "Pivot Aggregation" on the documentation website.