Metrics
This parameter controls the calculation of aggregate statistics across the entire set of shipment results for which the provided criteria matches, regardless of the actual number of records returned in the response.
Each data-source has its own set of available metrics and operators. Review the schema down below with the chosen data-source to view the available metrics.
Metric Examples
The following request selects for all shipments destined for the United States in January 2023, and calculates the total USD Value of all shipments, the largest volume shipment present, and the average weight of all the shipments.
{
"data_source": "global",
"filters": {
"shipment_destinations": "United States",
"record_date": {
"gte": "2023-01-01",
"lt": "2023-02-01"
}
}
"metrics": [
{ "metric": "value_usd", op: "sum" },
{ "metric": "volume_teu", op: "max" },
{ "metric": "weight_kg", op: "avg" },
]
}
When performing either a rollup or timeseries, any metrics that are specified will also be calculated for each aggregated bucket.
Shipment Count
The total number of shipment records selected in a search is listed under the record_count.total field,
or simply as record_count within any aggregated buckets when performing a time series or rollup aggregation.