Link Search Menu Expand Document

Statistics aggregation node

How to use the Statistics aggregation node

Overview

The statistics aggregation node allows you to filter on a set of items, in the same exact way as any other AQS Root Node. The result of a statistics aggregation is an attribute. It is one single attribute only when no grouping is applied, otherwise it is many attributes, one per group.

Note

API users utilising the following AQS statistics endpoint will need to ensure they use StatisticsAggregation instead of MathAggregation (deprecated), which will continue returning the same results, as it did with MathAggregation. Any existing integrations using the AQS statistics code will need to be updated to use StatisticsAggregation AQS item.

Operation types

The operation is run on the specified attribute of all the items that match the AQS query. A statistics aggregation root node thus needs to know which entity to act on (in the same way as the other root nodes), the attribute to consider and the operation to execute.

Note

The response model AqsStatisticsAggregationWebResponse only returns paginated results instead of duplicating information, for example, result and the groups properties (previously marked as Obsolete) will be removed as part of this change.

StatisticsAggregation supports the following aggregation types:

  • Sum: Only number attributes
  • Average: Only number attributes
  • Count: No attribute can be passed, it will fail if any attribute is specified
  • Max: Number, Date, Time and DateTime attributes
  • Min: Number, Date, Time and DateTime attributes
  • StandardDeviationPopulation: Only number attributes
  • StandardDeviationSample: Only number attributes
  • BoundingBox: Only geometry attributes

This node supports GeoJson Aggregation. You can aggregate on GeoJson geometry attributes, not only Number and DateTime.

The following examples illustrate the use of each of the operations types:

Grouping of statistics results

In addition to the above new operation types, you can now group statistics results using groupBy property tag.


Alloy is a Yotta Product
Yotta is a Connected Asset Management Software and Services company.
Our aspiration is to transform the management of the built world to create safer, cleaner and more sustainable places for everyone. Find out more about us here.