# Table decimal group rollup

`table-decimal-group-rollup` · version 1.0.0 · CSV & tables · free, no key needed

Sum exact decimal strings over deterministic SQL ROLLUP grouping sets with explicit subtotal markers.

**Use when you need to: rollup decimal table by dimensions · grouped rollup for json rows · exact decimal rollup table.**

## Decide before calling

Read the [versioned contract](/v1/tools/table-decimal-group-rollup/versions/1.0.0) and the supported scope below. Reuse `table-decimal-group-rollup@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `table-decimal-group-rollup@1.0.0` for rollup decimal table by dimensions. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- rollup decimal table by dimensions
- grouped rollup for json rows
- exact decimal rollup table
- sql rollup over table
- bounded grouped rollup
- deterministic rollup groups

## Not supported

- parse CSV text
- floating-point measures
- more than six dimensions

## Behavior

- Dimensions are compared as exact well-formed strings; missing and null are the same data-null group.
- Generated subtotal cells use subtotal true, while data null cells use subtotal false.
- Grouping sets are emitted in structural order; within each set null sorts before strings and strings sort by Unicode code point.
- Decimal addition is exact and output is canonical base 10 without exponent or negative zero.
- The output is capped at 50000 group rows and 16777216 UTF-8 bytes.

## Input

- `rows` (array of object, required): max items 10000
- `dimensions` (array of string, required): min items 1; max items 6; each min length 1; each max length 64
- `measure` (string, required): min length 1; max length 64

## Output

- `standard_version` (constant "ISO/IEC 9075-2:2016", required)
- `groups` (array of object, required): max items 50000

## Limits

- max input bytes: 16777216
- max rows: 10000
- max dimensions: 6
- max columns per row: 16
- max field bytes: 64
- max decimal bytes: 256
- max output rows: 50000
- max output bytes: 16777216

## Example

Request input:

```json
{
  "rows": [
    {
      "region": "east",
      "amount": "1.1"
    },
    {
      "region": "east",
      "amount": "2.2"
    }
  ],
  "dimensions": [
    "region"
  ],
  "measure": "amount"
}
```

Response:

```json
{
  "result": {
    "standard_version": "ISO/IEC 9075-2:2016",
    "groups": [
      {
        "dimensions": [
          {
            "value": "east",
            "subtotal": false
          }
        ],
        "count": 2,
        "sum": "3.3"
      },
      {
        "dimensions": [
          {
            "value": null,
            "subtotal": true
          }
        ],
        "count": 2,
        "sum": "3.3"
      }
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "table-decimal-group-rollup",
  "version": "1.0.0",
  "input": {
    "rows": [
      {
        "region": "east",
        "amount": "1.1"
      },
      {
        "region": "east",
        "amount": "2.2"
      }
    ],
    "dimensions": [
      "region"
    ],
    "measure": "amount"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/table-decimal-group-rollup/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"rows":[{"region":"east","amount":"1.1"},{"region":"east","amount":"2.2"}],"dimensions":["region"],"measure":"amount"}'
```

The machine-readable contract is at [/v1/tools/table-decimal-group-rollup/versions/1.0.0](/v1/tools/table-decimal-group-rollup/versions/1.0.0).

### CLI

```sh
node cli.mjs run table-decimal-group-rollup 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Table decimal group count](/tools/table-decimal-group-count): Count rows by exact string-valued dimensions with stable, bounded grouping output.
- [Table decimal group cube](/tools/table-decimal-group-cube): Sum exact decimal strings over deterministic SQL CUBE grouping sets with explicit subtotal markers.
- [Table aggregate check](/tools/table-aggregate-check): Check claimed COUNT/SUM/AVG/MIN/MAX results over JSON rows exactly (SQL nulls); returns the first mismatch.
- [Table decimal group average](/tools/table-decimal-group-average): Group table rows by string keys and compute exact decimal average results with deterministic ordering.
- [Table decimal group extrema](/tools/table-decimal-group-extrema): Group table rows by string keys and compute exact decimal extrema results with deterministic ordering.
- [Table decimal group sum](/tools/table-decimal-group-sum): Group table rows by string keys and compute exact decimal sum results with deterministic ordering.
