When utilizing state data for Workflows, Dashboards, and Notebooks, there are a number of aggregation methods that can be applied to raw data. However, not all aggregation methods are available for all attribute data types.
The following data set will be used to describe the aggregation methods listed below:
[41, 80, 7, 90, 40, 89, 33, 21, 63]
These methods can be applied to all data types:
Returns the total number of data points within the aggregation bucket.
In our example,
Count will return
9, which is the total number of data points in the dataset.
Returns the first received (oldest) data point within the aggregation bucket.
For our dataset,
First will return
41, which is the first number in the dataset.
Returns the last received (most recent) data point within the aggregation bucket.
Last will return
63, or the last number in the dataset.
Returns the total time (in milliseconds) that an attribute equals a value within a given range of time. This method is not valid for attribute calculation of System devices. For multiple devices, the total time is averaged.
For example, return the number of times an attribute reported any value within a given time range. In the diagram above, the time spent at value 3 was 5 hours.
For this aggregation, an additional argument must be specified.
Matching Value: Attribute value to match within a time range for calculating the time at that value.
true values are cast to the number
false values are cast to
0 when calculating these results.
Returns the maximum (highest) value of all points within the aggregation bucket.
In the dataset above, the
Max will be reported as
Returns the minimum (lowest) value of all points within the aggregation bucket.
Using the dataset, the
Min value will be
Returns the median (middlemost) value of all points within the aggregation bucket.
In the example dataset, the
Median will be
Returns the mean, or average, of all values within the aggregation bucket.
mean for the example dataset will be calculuated as
Returns the summation of all values within the aggregation bucket.
sum of the example dataset will be calculated as
Returns the sample standard deviation of the aggregation bucket.
Standard Deviation will be calculated as