---
title: "ResourceShark totals"
description: "Learn how totals combine current balances and sum movements by reason over a period."
url: "https://agentpost.tools/docs/resourceshark/concepts/totals"
kind: concept
---

# Totals

A totals report reads several resources in one request. Each row gives the resource’s current balance across its scopes and, when you ask for a period, its [movements](/docs/resourceshark/concepts/movements.md) summed by reason. Your server reads totals with the project’s secret key.

## Selection and balance

Select resources by `resourceId`, `tag`, or `attribute.<name>`. The report includes every resource that matches all the filters, including archived ones. `holderRef` limits the totals to that holder’s scopes.

A row gives the resource’s unit and the sum of `onHand`, `held`, and `available` over its selected scopes. The report uses `asOf` to decide which supply has started and which supply or holds have expired, regardless of the movement period. A write that commits during the read can appear in a row. For a resource that counts time in buckets, `balance` is `null` because each bucket has its own balance.

## Movement period

`from` and `to` come together. The report includes movements at `from` and excludes those at `to`. For each reason, it adds the signed changes to on hand. A movement that changes only `held` or `expected` contributes zero. A movement over time counts one bucket, so taking one room for three nights contributes three units across the bucket movements.

Your app chooses which reasons count as usage. It adds rows only when their unit codes and precision match.

## Groups

With `groupBy`, a resource that keeps [supply](/docs/resourceshark/concepts/supply.md) entries apart breaks its totals down by the value of one attribute on those entries. A movement contributes to the groups of the supply entries it names. An entry without the attribute falls in the group with `value: null`. So does what a balance [owes](/docs/resourceshark/concepts/supply.md#owing), and what a hold holds with no entry. On a balance with either, the null group also counts all of that balance’s `available`. On a running balance or a resource that counts time in buckets, `groups` is `null`.

## Limits

A totals request selects at most 100 resources and covers a movement period of at most 366 days.

## Where to act on it

-   [Sum usage with totals](/docs/resourceshark/guides/usage-totals.md) reads and combines per-resource rows.
-   [Reports](/docs/resourceshark/reference/reports.md) has the totals query and answer.
