Why weighted sum metrics show 0 in the UI but track negative values internally
Last updated: April 22, 2026
When a weighted sum metric receives negative events that push the running aggregation below zero, the current usage display in the UI and API shows 0 rather than the negative value. This display behavior is correct and intentional. The aggregation engine tracks the true running total internally, including negative values, and that internal state is used when calculating fees at billing time.
How weighted sum aggregation works
The weighted sum metric aggregates events by summing their values over the billing period, weighted by the proportion of time each value was held. When events push the total below zero, the engine holds the true negative value in its internal state. Because a negative unit count has no billing meaning, the UI and current usage API surface a floor of 0.
Three things to keep in mind:
The engine tracks the full signed value internally, including negative.
Displayed usage in the UI and via the current usage endpoints floors at
0.Subsequent positive events are applied on top of the true internal state, not the displayed
0.
For example, with the following sequence of events:
Event | Value | Engine Total | Displayed usage |
#1 | +10 | 10 | 10 |
#2 | −15 | −5 | 0 |
#3 | +10 | 5 | 5 |
After event #3, the displayed usage is 5 rather than 10, because the engine correctly carried the −5 internal state from event #2.
How to know what the internal weighted sum is
You can call the current-usage endpoint on the subscription. If there is a negative internal value, it will show up in the total_aggregated_units property.
This article reflects guidance drawn from customer case resolutions. It is not officially supported documentation and may not apply to all situations.