Calculate Value over Time Span for Label Node Configuration Guide

The Calculate Value over Time Span for Label Node performs a time-bounded aggregation (e.g., sum) of values grouped by label. It computes the result over a historical time span ending at the current moment or a defined timestamp, returning a single o

What It Does

This node aggregates historical values—such as totals, averages, or counts—for one or more device label groups. It computes the result across a specified time span (e.g., last 60 seconds or 30 minutes), enabling time-based rollups grouped by business or system-defined labels (e.g., Products, Zones, Machines).


Step-by-Step: How to Configure the Node

  1. Add the node

    • Drag the Calculate Value over Time Span for Label Node from the Logic panel into the workflow canvas.

  2. Connect to an upstream data stream

    • Link the node to one or more sources emitting JSON data that includes values to be aggregated.

  3. Open configuration

    • Double-click the node to begin configuration.


Configuration Fields

Field Requirement Description
Node Name* Required Identifier for this node in the workflow.
JSON Key* Required Field to evaluate in incoming payloads (e.g., power_kw, units).
Calculation* Required Aggregation function:
Sum, Average, Min, Max, Count, etc.
Calculation Time Span* Required Duration over which values should be aggregated (e.g., 30).
Calculation Time Span Units* Required Unit of the time span (e.g., Seconds, Minutes, Hours).
Calculation Ends Optional Default: Up to current timestamp. This defines the endpoint of the time window.
Time Zone* Required Time zone context for interpreting timestamps:
UID time zone, UTC, etc.
Output JSON Key Optional Custom field name for the output result. If not defined, a default will be used.
Data Source Label(s)* Required One or more labels (e.g., Products, Location) that define how data is grouped.
Decimal Places Optional Number of decimal places to round the result to (e.g., 2).
 

Add multiple labels if the aggregation should be performed across several categories.


Output Behavior

The output is a JSON object keyed by label, each containing the result of the time-bounded aggregation. Example:

json
CopyEdit
{
"Products": {
"Product A": {
"energy_sum": 1534.67
},
"Product B": {
"energy_sum": 1021.42
}
}
}

The structure depends on:

  • The JSON Key

  • The Output JSON Key

  • The selected Label(s)


Best Practices

  • Use consistent time units across your workflows (e.g., seconds or minutes) to avoid confusion.

  • Set a descriptive output key (e.g., label_energy_sum) to prevent overwriting other values.

  • When using multiple labels, ensure all upstream payloads are correctly labeled.

  • Avoid setting overly short time spans on sparse data streams—this can yield null or zero results.


Use Cases

  • Aggregate total energy usage per product over the last 24 hours

  • Sum the number of units produced per line every 10 minutes

  • Average the flow rate across machines grouped by label Zone

  • Count the number of fault messages per device type every hour


 FAQ

Q: What happens if no data exists in the time window?

A: The node outputs either null or 0 (depending on the aggregation function) for the affected label.

Q: Can I use this for rolling window calculations?

A: Yes — if placed in a continuous workflow, this node performs a rolling time window analysis ending at the current time.

Q: Does the node aggregate across multiple UIDs?

A: Yes, all devices sharing the same label value are aggregated together.