Follow

# Basic Aggregation Methods

You have already been introduced to Flow Aggregation Methods.  Let's look at how each of the standard Aggregation Methods that Flow provides transforms (i.e. aggregates) data points within a single time period.  The sample data introduced earlier is shown here again.

 Point Timestamp Raw Value 1 05:55:03 1.6 2 06:03:23 2.3 3 06:07:30 2.5 4 06:10:22 3 5 06:15:52 2.1 6 06:20:40 1.9 7 06:25:13 2.5 8 06:29:44 2.3 9 06:35:14 1.6 10 06:41:14 1.8 11 06:46:03 2.3 12 06:52:35 2.9 13 06:55:26 2.2 14 07:05:40 1.4

### Sum

When using the “Sum” aggregation method, Flow will calculate the sum of points 2 to 13. It will exclude the “boundary” value, since point 1 before the “boundary”, would have been used in the previous time period’s calculation.

With the above data points, Sum = 28.8

### Average

When using the “Average” aggregation method, Flow calculates a time weighted average. The “boundary” value is included in the calculation.

With the above data points, Average = 2.213722222

See the article on time weighted averages for a detailed explanation on how this is calculated.

### Minimum

When using the “Minimum” aggregation method, Flow determines the minimum value of all the points within the time period, including the “boundary” value.

With the above data points, Minimum = 1.6

While Point 14 has a value of 1.4, it is not included in the minimum aggregation because it is outside the time period.

### Maximum

When using the “Maximum” aggregation method, Flow determines the maximum value of all the points within the time period, including the “boundary” value.

With the above data points, Maximum = 3

### Range

When using the “Range” aggregation method, Flow determines the maximum and the minimum values of all the points within the time period, including the “boundary” value, and then returns the difference between the maximum and the minimum.

With the above data points, Range = Maximum - Minimum = 3 - 1.6 = 1.4

### First

When using the “First” aggregation method, Flow will return the “boundary” value.

With the above data points, First = 1.6

### Last

When using the “Last” aggregation method, Flow will return the value of the last point before the end of the time period.

If a point falls exactly on the end of the time period (i.e. 07:00:00), it will be excluded from the evaluation.

With the above data points, Last = 2.2

### Delta

When using the “Delta” aggregation method, Flow will sum the difference between each consecutive point, including the “boundary” point.

With the above data points, Delta = 0.6, the sum of all the values in the Delta column in the table below.

 Point Timestamp Raw Value Delta 1 05:55:03 1.6 N/A 2 06:03:23 2.3 0.7 3 06:07:30 2.5 0.2 4 06:10:22 3 0.5 5 06:15:52 2.1 -0.9 6 06:20:40 1.9 -0.2 7 06:25:13 2.5 0.6 8 06:29:44 2.3 -0.2 9 06:35:14 1.6 -0.7 10 06:41:14 1.8 0.2 11 06:46:03 2.3 0.5 12 06:52:35 2.9 0.6 13 06:55:26 2.2 -0.7 14 07:05:40 1.4 N/A

### Count

When using the “Count” aggregation method, Flow will return the number of points within the time period, excluding the “boundary” point.

With the above data points, Count = 12.

### Time in State

When configuring Flow to return a “Time in State” summary, you will need to specify the “State” setting and condition. Flow will return the total duration (in milliseconds) that the “Stair Step” interpolation evaluates to the specified “State” setting and condition.

 Point Timestamp Raw Value Duration (seconds) 1 05:55:03 1.6 203 2 06:03:23 2.3 247 3 06:07:30 2.5 172 4 06:10:22 3 330 5 06:15:52 2.1 288 6 06:20:40 1.9 273 7 06:25:13 2.5 271 8 06:29:44 2.3 330 9 06:35:14 1.6 360 10 06:41:14 1.8 289 11 06:46:03 2.3 392 12 06:52:35 2.9 171 13 06:55:26 2.2 274 14 07:05:40 1.4 N/A

For example, in the above scenario, if the “State” setting is specified as “=” 1.6, Flow will sum the duration between the “boundary” point and point 2, and the duration between point 9 and point 10.

So, Time In State = 563000ms

Remember that Flow does all its time-related calculations in milliseconds and not seconds

### Variance

When using the “Variance” aggregation method, Flow will calculate the statistical population variance for all the data points within the time period, including the “boundary” point.

With the above data points, Variance = 0.17751479

### Standard Deviation

When using the “Standard Deviation” aggregation method, Flow will calculate the statistical population standard deviation for all the data points within the time period, including the “boundary” point.

With the above data points, Standard Deviation = 0.42132504.