Latest row per entity
Build current-state analytics over append-only event streams with latest_by.
ReportPlane ingest remains append-only. When a collector sends another observation for the same entity, keep both records and use latest_by in an Analytics definition to select one latest matching record per entity before normal dimensions and metrics run.
{
"dimensions": [{ "field": "status", "alias": "label" }],
"metrics": [{ "aggregation": "count", "alias": "total" }],
"latest_by": {
"partition_by": ["device_id"],
"order_by": [
{ "field": "revision", "direction": "desc" },
{ "field": "collected_at", "direction": "desc" }
]
},
"order_by": [{ "field": "total", "direction": "desc" }]
}
partition_by identifies the entity. order_by determines which matching observation wins. Use a monotonic revision or source update timestamp first and a deterministic collector timestamp as a tie-breaker when available. Both lists accept up to four top-level scalar model fields.
Filter semantics
Required filters, query-client access filters, and approved runtime filters constrain candidate records first. ReportPlane then selects the latest candidate in every partition and runs the saved aggregation. This is latest matching row semantics.
For example, a runtime time range means “latest observation for each device inside this range,” not necessarily the device's all-time latest state. Omit the time filter when the question requires the latest available state over the complete retained history.
Warehouse parity
The definition is provider-neutral. BigQuery, ClickHouse, and Snowflake execute a windowed plan. Elasticsearch and OpenSearch select one top hit per bounded composite partition and apply the same result contract. The existing Analytics row and grouped-result safeguards remain authoritative.