# Mango Rollups and Statistics

# Rollups

Rollup statistics are quantized periods of data that return a desired statistic for that period of time. One example rollup operation would be to request the average point value for point 1 for the past day in 1 hour intervals. This would return 12 entries with the hourly average for each hour.

If no data is present in the period some statistics will be empty while others that depend on the pervious value to the period will not. When understanding the rollup statistics it is important to note that some statistics use one value prior and one value after the period if they are available. This *continuous time *effect is useful for charting and important to understand when doing analysis with the values.

Note: the REST api calls with rollups return the times for all values as the period start time. To get the actual times for every statistic one needs to use the statistics endpoint.

## Numeric Rollups

The following rollup types are available for Numeric data points:

- Accumulator - The last value in the period or the value prior to the period if there are no values in the period
- Average - The average value for the period, taking into consideration the value prior to and after the period using weighted averages based on time
- Count - The number of values within the period
- Delta - The change in value during the period
- First- The first value within the period
- Integral - The integral of the values during the period, taking into consideration the value prior to and after the period using weighted averages based on time
- Last - The last value within the period
- Maximim - The largest value of any values in the period or the value prior to or just after
- Minimum - The smallest value of any values in the period or the value prior to or just after
- Sum - The total of all values within the period

## Non Numeric Rollups

The following rollup types are available for Alphanumeric, Binary and Multistate points:

- Count - The number of values within the period
- First- The first value within the period
- Last - The last value within the period

# Statistics

Mango can provide statistics for a period of time, the group of statistics returned depends on the data type of the point.

## Starts And Runtime List

Binary and Multistate points have these statistics to help understand the states that the point was in during the period.

- First - The first value in the period and the time it occurred
- Last - The last value in the period and the time it occurred
- Count - The count of values within the period
- Starts And Runtimes - A list of the states with the following statistics for each
- Runtime - The total time in this state
- Proportion - The proportion of time in this state
- Starts - The number of occurrences of this state

**Value Change Counts**

Alphanumeric and Image data types have these statistics.

- First - The first value in the period and the time it occurred
- Last - The last value in the period and the time it occurred
- Count - The count of values within the period
- Changes - The number of changes in state during the period

## Analog Statistics

Numeric points have these statistics.

- Accumulator -
*Not provided yet* - Average - The average value for the period, taking into consideration the value prior to and after the period using weighted averages based on time
- Count - The number of values within the period
- Delta -
*Not provided yet* - First- The first value within the period and the time it occurred
- Integral - The integral of the values during the period, taking into consideration the value prior to and after the period using weighted averages based on time
- Last - The last value within the period and the time it occurred
- Maximim - The largest value of any values in the period or the value prior to or just after and the time it occurred
- Minimum - The smallest value of any values in the period or the value prior to or just after and the time it occurred
- Sum - The total of all values within the period at the end time of the period