Filtering aggregate data
When calculating aggregate data, you can specify a filter condition to determine which rows to factor in the calculation. For example, you can exclude rows with missing or null credit limit values when calculating an average credit limit, or include only deposit transactions when calculating the sum of transactions.
To specify a filter condition when aggregating data, in Aggregation Builder, specify a filter expression that evaluates to true or false. The following examples of aggregations include filter conditions:
If summing the values in the Extended_Price field, adding the following filter expression returns the sum of extended prices for item MSL3280 only:
row["itemCode"] == "MSL3280"
If averaging the values in the orderAmount field, adding the following filter expression returns the average order amount for closed orders only:
row["orderStatus"] == "Closed"
Figure 10‑13 shows an example of an aggregation in Aggregation Builder that includes a filter condition. The aggregation returns the sales total for item MSL3280.
Figure 10‑13 Aggregation definition that includes a filter condition