Data Aggregations

When utilizing state data for Workflows, Dashboards, and Notebooks, there are a number of aggregation methods that can be applied to your raw data. However, not all aggregation methods are available for all attribute data types.

All Data Types

These methods can be applied to all data types:

Count

Returns the total number of data points within the aggregation bucket.

For example, return the number of times X occurred between A and B.

First

Returns the first received (oldest) data point within the aggregation bucket.

For example, return the A value between A and B.

Last

Returns the last received (most recent) data point within the aggregation bucket.

For example, return the B value between A and B.

Time At Value

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 time that X was at Y between A and B.

For this aggregation, you must specify an additional argument:

Matching Value: Attribute value to match within a time range for calculating the time at that value.

Number and Boolean Aggregations

The methods below are only available for number and boolean data types.

For booleans, true values are cast to the number 1 and false values are cast to 0 when calculating these results.

Max

Returns the maximum (highest) value of all points within the aggregation bucket.

For example, return the max value between A and B.

Min

Returns the minimum (lowest) value of all points within the aggregation bucket.

For example, return the minimum value between A and B.

Median

Returns the median (middlemost) value of all points within the aggregation bucket.

For example, return the median between A and B.

Mean

Returns the mean, or average, of all values within the aggregation bucket.

For example, return the mean value between A and B.

Sum

Returns the summation of all values within the aggregation bucket.

For example, return the sum of all the values between A and B.

Standard Deviation

Returns the standard deviation of the aggregation bucket.

For example, return standard deviation of the set of values between A and B.