Skip to content
Stand with Ukraine flag

Related Entities Aggregation

Related entities aggregation collects the latest telemetry or attribute values from multiple entities related to the target entity, applies aggregation functions, and stores the result on the target entity. For example, a Building A asset can compute avgTemperature and maxTemperature from all child sensor devices automatically.

Use Related entities aggregation when you need:

  • Fleet or building dashboards — average temperature, total power, max vibration across devices
  • Operational KPIs — count of active devices, count of alarms, percentage online
  • Occupancy tracking — count devices in a specific state
  • Quality monitoring — min/max readings across a group
  • Filtered aggregation — aggregate only a subset (e.g., only devices with status = "active")
  1. Open the Calculated fields page.
  2. Click the + Add calculated field ⇾ Create new calculated field in the top-right corner.
  3. In General, enter a title, specify the entity the field applies to, and select the Related entities aggregation type.
  4. Configure the Aggregation path, Arguments, Metrics, and Output.
  5. Click Add to save.

Defines which related entities contribute data:

SettingOptions
Relation directionDown to child — data is aggregated from child entities
Up to parent — data is aggregated from parent entities
Relation typeThe relation type between the target entity and related entities (e.g., Manages, Contains)

Arguments define what data is read from each related entity.

Click Add argument and fill in:

FieldDescription
Argument typeLatest telemetry or Attribute
Time series key / Attribute keyThe key to read from each entity
Argument nameVariable name used in metrics
Default valueFallback if data is missing on an entity

For full argument configuration details, see Calculated Fields — Arguments.

Each metric produces one output key by applying one aggregation function to one argument.

Click Add metric and configure:

FieldDescription
Metric nameOutput key stored on the target entity (e.g., avgTemperature)
AggregationAverage, Min, Max, Sum, Count, or Count unique
Filter (optional)A TBEL function returning true/false to include/exclude entities
Value sourceKey (direct argument value) or Function (computed value)
Argument nameThe argument whose data is aggregated

Filter example — include only active devices above a threshold:

return temperature > 10 && status == "active";

Deduplication interval: limits how often aggregation runs when many entities send frequent updates. The first update triggers aggregation; subsequent updates within the interval are ignored. After the interval ends, aggregation runs again with the latest data. Minimum interval: 10 seconds.

Results are stored as time series or attributes on the target entity. Optionally set Decimals to round values. For time series output, enable Use latest timestamp to align with source data.

For output strategy options, see Calculated Fields — Output Strategy.


Example: Aggregate Temperature from Child Devices

Section titled “Example: Aggregate Temperature from Child Devices”

Multiple temperature sensors are installed in Building A and publish temperature as telemetry.
Goal: compute avgTemperature and maxTemperature across all sensors and store them on Building A.

Import the demo devices and asset, then connect them:

  1. Download device-data-with-temperature-telemetry.csv and import it as devices with delimiter ,; set the temperature column type to Time series. Creates Smart Device 1, Smart Device 2, and Smart Device 3 (profile: sensor).
  2. Download building-asset-data.csv and import it as asset with delimiter ,. Creates Building A (type: building).
  3. Open Building A, go to the Relations tab, and add:
    • Building ASmart Device 1, Smart Device 2, and Smart Device 3
      • Relation direction: From
      • Relation type: Manages
  1. Apply the Related entities aggregation calculated field to the Building A device profile.
  2. Aggregation path:
    • Relation direction: Down to child
    • Relation type: Manages
  3. Add argument:
    • Argument type: Latest telemetry
    • Time series key: temperature
    • Argument name: temperature
    • Default value: 0
  4. Add metric 1:
    • Metric name: avgTemperature
    • Aggregation: Average
    • Value source: Key
    • Argument name: temperature
  5. Add metric 2:
    • Metric name: maxTemperature
    • Aggregation: Max
    • Value source: Key
    • Argument name: temperature
  6. Set Deduplication interval: 60 seconds.
  7. Output type: Time series.
  8. Click Add.

Result: Building A stores aggregated telemetry:

{ "avgTemperature": 22.7, "maxTemperature": 25.1 }

These values update whenever any child sensor reports new temperature data.