Overview
When you query historical data in Mango by Radix IoT, you rarely want every raw sample. A data point logging every 5 seconds produces 17,280 values per day. Rollups aggregate those raw samples into meaningful summaries – averages, totals, minimums, maximums – over fixed time periods. They are used throughout Mango in charts, watchlist tables, Excel reports, and REST API responses.
Two things about Mango’s rollups routinely catch people out, and both are covered in detail below:
- AVERAGE is time-weighted, not the arithmetic mean. A separate ARITHMETIC_MEAN rollup gives the unweighted sample mean. On irregularly sampled data the two differ, sometimes substantially.
- INTEGRAL integrates over seconds. A point in kW yields kW·seconds by default, not kWh, unless you configure the point’s integral unit.
Prerequisites
- Mango 4.x or 5.x
- At least one data point with logged history in the range you intend to query
- Permission to read the point, and access to charts, reports, or the REST API
- For energy work: knowing the point’s engineering unit and its configured integral unit
What Is a Rollup?
A rollup divides a time range into equal intervals (called rollup periods) and applies an aggregation function to each interval. For example, requesting a 1-hour AVERAGE rollup over 24 hours returns 24 values – one average per hour.
Raw samples: |...........|...........|...........|
0h 1h 2h 3h
Rollup: [ avg=72.3 ] [ avg=73.1 ] [ avg=71.8 ]
Accurate statistics need to know the value in force when the period opened, so Mango carries a start value into each period: the point’s value as of the period boundary, which is usually the last sample logged before it. Several rollups below behave differently depending on whether that start value exists.
Numeric Rollups
These rollups apply to Numeric (analog) data points:
| Rollup | Description | Common Use |
|---|---|---|
| AVERAGE | Time-weighted average over the period | Temperature trending, general monitoring |
| ARITHMETIC_MEAN | Unweighted mean of the samples logged in the period (sum ÷ count) | Comparing evenly sampled series |
| MINIMUM | Lowest value, taking the start value into account | Finding dips, low-water marks |
| MAXIMUM | Highest value, taking the start value into account | Peak detection, capacity planning |
| MINIMUM_IN_PERIOD | Lowest value among samples actually logged inside the period | Excluding a carried-in start value |
| MAXIMUM_IN_PERIOD | Highest value among samples actually logged inside the period | Excluding a carried-in start value |
| RANGE_IN_PERIOD | MAXIMUM_IN_PERIOD minus MINIMUM_IN_PERIOD | Spread or volatility within the period |
| SUM | Sum of all sample values | Batch counting, pulse accumulation |
| COUNT | Number of samples in the period | Data quality verification |
| FIRST | First value logged in the period | Start-of-period snapshot |
| LAST | Last value logged in the period | End-of-period snapshot |
| START | Value in force at the exact start of the period | Opening value |
| DELTA | Last value minus the period’s start value | Consumption from accumulating meters |
| INTEGRAL | Time-weighted integration over the period | Energy and flow totals |
| ACCUMULATOR | The last value in the period; the maximum if there is no last value | Meter totals, odometer-style readings |
| ALL | Returns all raw samples (no aggregation) | Data export, debugging |
| NONE | No rollup applied | Raw or latest-value queries |
| POINT_DEFAULT | Uses the rollup configured on the data point itself | Letting each point carry its own default |
Warning
AVERAGE is time-weighted. Mango holds each value in force until the next one arrives, multiplies each value by how long it was in force, sums those products, and divides by the period duration. It does not average the samples equally. For a point that sits at 20 for 55 minutes and then jumps to 80 for 5 minutes, the time-weighted AVERAGE is 25 while the arithmetic mean of the two samples is 50. Use ARITHMETIC_MEAN when you specifically want the unweighted sample mean, and confirm your query surface exposes it before designing a report around it.
Note
The value is held flat across the elapsed time – a step, or zero-order hold. Mango does not interpolate a straight line between consecutive samples, so this is not trapezoidal integration and does not produce trapezoidal-rule results.
Tip
DELTA is ideal for utility meters that report cumulative readings. If a meter reads 10,500 kWh as the period opens and 10,620 kWh at the end, DELTA returns 120 kWh consumed. Note that the subtraction uses the start value carried into the period when one exists, falling back to the first sample logged inside the period only when it does not – so consumption is not silently lost at period boundaries.
Warning
INTEGRAL integrates over seconds. The default integral unit is the point’s unit multiplied by seconds, so a point in kW produces kW·s, and a steady 1 kW for one hour returns 3600, not 1. To read kWh directly, configure a compatible integral unit of kWh on the data point; Mango then converts the raw aggregate into that unit for display. Check the point’s configuration before presenting an integral as kWh, and be aware that a raw API response may carry the unconverted value.
Note
ACCUMULATOR is not a running total and does not assume an increasing counter. It returns the last value in the period, or the maximum value when the period has no last value. Use DELTA for consumption between two readings.
Non-Numeric Rollups
Binary, Multistate, and Alphanumeric data points support only the subset of rollups that make sense without arithmetic:
| Rollup | Description |
|---|---|
| NONE | No rollup applied |
| FIRST | First value in the period |
| LAST | Last value in the period |
| COUNT | Number of samples |
| ALL | All raw samples |
| START | Value in force at period start |
| POINT_DEFAULT | Defers to the rollup configured on the point |
Rollups that require arithmetic – AVERAGE, ARITHMETIC_MEAN, SUM, DELTA, INTEGRAL, ACCUMULATOR, the minimum and maximum family – are numeric-only. Requesting one for a non-numeric point is not supported.
Statistics by Data Type
When you request detailed statistics (not a single rollup), Mango returns a statistics object that varies by data type:
Analog Statistics (Numeric Points)
| Statistic | Description |
|---|---|
average |
Time-weighted average |
statistics |
Summary object carrying the unweighted sample mean, min, max and count. There is no arithmeticMean field on the analog result — ARITHMETIC_MEAN exists as a rollup, and the unweighted mean arrives here |
minimumValue |
Minimum value, accounting for the start value (its timestamp is minimumTime) |
maximumValue |
Maximum value, accounting for the start value (its timestamp is maximumTime) |
minimumInPeriod / maximumInPeriod |
Minimum and maximum among samples logged inside the period |
sum |
Sum of all values |
count |
Number of samples |
integral |
Time-weighted integration, in source unit × seconds unless an integral unit is configured |
delta |
Last value minus the start value, falling back to the first sample when no start value exists |
first |
First sample (value + time) |
last |
Last sample (value + time) |
start |
Value in force at period start (value + time) |
changes |
Number of times the value differed from the preceding one |
periodStartTime / periodEndTime |
The period the statistics cover |
State and Runtime Statistics (Binary, Multistate, and Alphanumeric Points)
All three non-numeric data types go through the same statistics path. There is no separate, reduced result shape for alphanumeric points – an alphanumeric point gets state-and-runtime statistics exactly as a binary or multistate point does, treating each distinct string as a state.
| Statistic | Description |
|---|---|
data |
One entry per distinct value, each carrying runtime (ms in that value), starts (times it entered that value), proportion (0.0 - 1.0) and percentage |
count |
Number of values recorded in the period |
changes |
Number of times the value differed from the preceding one |
first |
First value in the period |
last |
Last value in the period |
start |
Value in force at period start |
For a binary point tracking a pump, the data list shows how many milliseconds the pump was ON versus OFF, the proportion (e.g., 0.75 = 75% runtime), and starts — how many times it cycled on, which is what you want for short-cycling and maintenance-interval work. For an alphanumeric status point, the same structure tells you how long the device reported each distinct status string.
Note
Field names in REST responses come from the shipped REST module and can differ from the internal statistic names above. Inspect an actual aggregate response on your own server before mapping these into a report or an integration.
Using Rollups in Charts
When configuring charts in the Dashboard Designer or custom pages:
- Select the data point(s) to display
- Set the range in the Date range picker — the Quick dates presets cover the common
windows, and Update date range applies it - Choose a Rollup (e.g., AVERAGE)
- Set the period with Time period type and Time periods (e.g., MINUTES and 15) — the
same pair the REST API takes astimePeriodTypeandtimePeriods
Choosing the Right Rollup Period
| Time Range | Suggested Rollup Period | Resulting Points |
|---|---|---|
| Past 1 hour | 1 minute | 60 |
| Past 24 hours | 15 minutes | 96 |
| Past 7 days | 1 hour | 168 |
| Past 30 days | 6 hours | 120 |
| Past 1 year | 1 day | 365 |
Tip
The periods above, and the rough target of 50-500 points per chart series, are starting guidelines rather than product limits. The right number depends on your data density, browser, and query latency – benchmark a representative dashboard and tune from there.
Warning
A rollup summarises the samples that exist; it does not invent samples that do not. If a point stopped logging for six hours, a rollup over that window returns empty or null periods rather than filling them in. When a report shows gaps, investigate the cause – logging configuration, source health, the query’s time range, or purge history – rather than switching to a rollup and treating the smoother-looking output as a fix.
Using Rollups in the REST API
Query rolled-up values using the point-values time-period endpoint. The rollup is part of
the path, not a query parameter:
# Get hourly averages for the past 24 hours
curl "http://localhost:8080/rest/latest/point-values/time-period/DP_TEMP_001/AVERAGE?from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&timePeriodType=HOURS&timePeriods=1" \
-H "Authorization: Bearer YOUR_TOKEN"
Response:
[
{ "timestamp": 1704067200000, "value": 72.3 },
{ "timestamp": 1704070800000, "value": 73.1 },
{ "timestamp": 1704074400000, "value": 71.8 }
]
API Parameters for Rollups
| Parameter | Values | Description |
|---|---|---|
rollup |
NONE, AVERAGE, ARITHMETIC_MEAN, DELTA, MINIMUM, MAXIMUM, MINIMUM_IN_PERIOD, MAXIMUM_IN_PERIOD, RANGE_IN_PERIOD, ACCUMULATOR, SUM, COUNT, INTEGRAL, FIRST, LAST, START, ALL, POINT_DEFAULT | Aggregation function. Supplied as a path segment, not a query parameter |
timePeriodType |
MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS | Rollup period unit |
timePeriods |
Integer | Number of time period units per rollup |
Warning
Do not query history at /point-values/{xid}. That path exists, but only as PUT (set a point’s value) and DELETE (delete point values) — a GET against it will not return history, and the neighbouring verbs modify data. Rolled-up history comes from /point-values/time-period/{xid}/{rollup}, and from and to are both required there.
Note
The rollup names above are the ones Mango defines internally. Which of them a given endpoint accepts is decided by the REST module you have installed, so check your server’s API documentation before relying on the less common ones.
Practical Examples
Example 1: Daily Energy Consumption
For a kW power meter, use the INTEGRAL rollup with a 1-day period. Before reading the result as kWh, configure the point’s integral unit as kWh – otherwise the aggregate is in kW·seconds and a day at a steady 1 kW returns 86,400 rather than 24.
Example 2: Peak Demand Detection
Use the MAXIMUM rollup with a 15-minute period to find the highest demand interval, which is how most utilities calculate demand charges.
Example 3: Equipment Runtime Report
For a binary pump-status point, query /rest/latest/point-values/statistics/{xids} to get the runtime proportion. A proportion of 0.82 means the pump ran 82% of the tracked runtime in the queried period.
Example 4: Data Quality Check
Use the COUNT rollup to verify how many samples were logged per hour. If your point polls every 10 seconds, you expect 360 samples per hour. Significantly fewer indicates data gaps.
Verification
Before trusting rolled-up figures in a report or dashboard:
- Confirm which average you are getting. Query an irregularly sampled point with both AVERAGE and ARITHMETIC_MEAN over the same period; if the numbers differ, the weighting is doing exactly what it should, and you need to decide which one your report means
- For any INTEGRAL, create a point held at a constant 1 kW for one hour and query it. An unconfigured integral unit returns 3600 (kW·s); with the integral unit set to kWh you should see 1
- Compare DELTA against the meter’s own start and end readings for the same window, and check that consumption spanning a period boundary is not lost
- Aggregate an alphanumeric point and confirm you receive state and runtime statistics, including count and changes
- Create a deliberate acquisition gap, then query raw and rolled-up data over it and confirm the rollup reports empty periods rather than manufacturing values
- Check COUNT against the expected sample count for the point’s logging configuration
Troubleshooting
Rollup returns null or no data
- The data point must have logged values in the requested time range
- Verify the point’s logging type is not set to “Do not log”
- Check that the time range parameters are in the correct ISO 8601 format
AVERAGE does not match a hand-calculated mean
- This is expected. AVERAGE is time-weighted: a value that persisted for 50 minutes counts ten times as much as one that persisted for 5
- Use ARITHMETIC_MEAN if you want each logged sample to count equally
- Irregular sampling amplifies the difference. Even interval logging makes the two converge
INTEGRAL values seem wrong
- Check the unit first. The default is source unit × seconds, not hours: a kW point returns kW·s, so an hour at 1 kW reads 3600
- Set a compatible integral unit on the point (kWh for a kW point) if you want the value rendered in energy units, and confirm whether the surface you are reading applies that conversion
- Ensure timestamps on the raw data are correct; gaps produce inaccurate integrals
DELTA returns negative values
- This is normal for meters that decrease or reset. Check for meter resets or rollover at 32-bit or 64-bit boundaries
- ACCUMULATOR is not the fix here: it returns the last value in the period (or the maximum when there is none), not a monotonically increasing total
Report has empty periods
- Rollups do not restore missing history. Check whether the point was logging, whether the data source was healthy, whether the requested range is correct, and whether purge has already removed the data
- Only once you know the samples exist should you reach for a rollup to summarise them
Chart shows flat lines instead of curves
- You may be using FIRST or LAST rollup, which returns a single value per period. Switch to AVERAGE for smoother trends
- Increase the number of rollup periods for more detail