Min
Aggregation functions min(imum)
syntax
- min(a)
- min(a, relation)
definition
- min(a) results in a Parameter with the minimum of the non Null values of Attribute a.
- min(a, relation) results in an attribute with the minimum of the non null values of attribute a, grouped by relation. The Domain unit of the resulting attribute is the Values unit of the relation.
description
The min function is not defined for boolean data items, use the Any function instead.
If there are no values to be aggregated for a group, the resulting value will be the maximum value for the Value type of attribute a (in the example: 4294967294, the maximum value for the value type: uint32).
applies to
- attribute a with Numeric, Point or string value type
- relation with value type of the group CanBeDomainUnit
conditions
- The values unit of the resulting data item should match with regard to value type and Metric with the values unit of attribute a.
- The domain of Argument a and relation must match.
performance
- Without relation: O(n) where n = number of elements in the domain of a. Single pass tracking minimum.
- With relation: O(n) where n = number of elements in the domain of a. Tracks minimum per group during a single pass.
example
parameter<uint32> minNrInh := min(City/NrInhabitants); result = 175
parameter<string> minCity := min(City/CityName); result = 'Amsterdam'
attribute<uint32> minNrInhRegion (Region) := min(City/NrInhabitants, City/Region_rel);
attribute<string> minCityNameRegion (Region) := min(City/CityName, City/Region_rel);
| City/NrInhabitants | City/CityName | City/Region_rel |
|---|---|---|
| 550 | Amsterdam | 0 |
| 525 | Rotterdam | 1 |
| 300 | Utrecht | 2 |
| 500 | DenHaag | 1 |
| 200 | Eindhoven | 3 |
| 175 | Haarlem | null |
| null | null | 3 |
domain City, nr of rows = 7
| minNrInhRegion | minCityNameRegion |
|---|---|
| 550 | Amsterdam |
| 500 | DenHaag |
| 300 | Utrecht |
| 200 | Eindhoven |
| 4294967294 | ÿÿÿÿ1 |
domain Region, nr of rows = 5
1) ÿÿÿÿ represents the max value for strings