Example: Aggregation
This example shows a simple aggregation of quantity and amount using the View function on the basis of a raw data table containing orders from different customers.
| Customer | Product | Quantity | Amount |
|---|---|---|---|
| CN002 | PROD01 | 40 | 23 |
| CN001 | PROD02 | 20 | 20 |
| CN004 | PROD01 | 30 | 33 |
| CN003 | PROD02 | 30 | 25 |
| CN001 | PROD03 | 33 | 40 |
| CN004 | PROD03 | 25 | 28 |
| CN002 | PROD01 | 25 | 30 |
-
Group customers that have the same characteristics (from the field Group).
Customer Product Quantity Amount CN001 PROD01 20 20 PROD02 33 40 CN002 PROD01 40 23 PROD02 25 30 CN003 PROD03 30 25 CN004 PROD03 30 33 PROD01 25 28 -
Count how many products there are in each grouped Customer (from the formula COUNT(PRODUCT)).
Customer Product Quantity Amount CN001 2 Products (PROD01 & PROD02) 20 20 33 40 CN002 2 Products (PROD01 & PROD02) 40 23 25 30 CN003 1 Product 30 25 CN004 2 Products (PROD03 & PROD01) 30 33 25 28 -
Add up the Quantity per grouped Customer (from the formula SUM(QUANTITY)) and the Amount per grouped Customer (from the formula field SUM(AMOUNT)).
Customer Product Quantity Amount CN001 PROD01 53 = 20 + 33 60 = 20 + 40 PROD02 CN002 PROD01 65 = 25 + 40 53 = 23 + 30 PROD02 CN003 PROD03 30 25 CN004 PROD03 55 = 30 + 25 61 = 33 + 28 PROD01 -
Result: Aggregate View
Customer Product Quantity Amount CN001 2 53 60 CN002 2 65 53 CN003 1 30 25 CN004 2 55 61