> For the complete documentation index, see [llms.txt](https://changelog.airship.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://changelog.airship.co.uk/may-2026/19-05-2026-fixing-metric-results.md).

# 19/05/2026 - Fixing metric results

Previously, saving a count or percentage metric could result in the value 365 being displayed instead of the real figure. This happened because the agent was building reporting queries that returned one row per customer (capped at the 365-row reporting limit) rather than a single aggregate row. The metric collection job would then sum those 365 rows and store 365 as the value.

What's fixed:

* Count metrics — the agent now uses the correct query shape (group\_by: \[] + aggregations: \[COUNT], no select\_fields) which produces a single aggregate row. The collected value is always the true count.
* Percentage metrics — type-8 KPI metrics now support a two-query pattern. Pass two reporting COUNT queries as series\[0] (numerator) and series\[1] (denominator) with value\_display: "percentage". The platform divides and multiplies by 100 at each daily collection, storing the correct percentage rather than a row count.

Example use case: "First-time visitors as a % of total visitors in the last 7 days, updated daily" — previously broken (returned 365), now works correctly.

:technologist: Jules
