Returns a two column table showing distinct values in the first column, and summed data in the second.
SppSumTableColumnByGroup([Table Array],[Group By Column],[Column To Sum],[Sort results on summed column])
Where:
Table Array is a Table Array (such as the data in a standard table, or the result of a QueryDataValues function.
Group By Column is the column in the Table Array that will be grouped.
Column To Sum is the column in the Table Array that will be summed for each unique value in the Group By Column.
Sort results on summed column (optional) is TRUE to sort the results by their respective sums in ascending order. Leaving blank or using FALSE will return the result in the order found in the initial array.
Rule | Result | Meaning |
---|---|---|
SppSumTableColumnByGroup(DwLookupStationaryOrder,1,3, TRUE) | {"Items","Sum(Quantity)";"Rubber",1;"2B Pencil",2;"Black Biro",2;"HB Pencil",5} | Will return an Array showing distinct values from the first column and summed data from the third column. |
This table shows an example order and where some items may of been added to an order more than once and there quantities need adding together.
Item | Price | Quantity |
---|---|---|
HB Pencil | 0.60 | 3 |
2B Pencil | 0.60 | 2 |
Black Biro | 0.80 | 1 |
Rubber | 1.50 | 1 |
HB Pencil | 0.60 | 2 |
Black Biro | 0.80 | 1 |