> For the complete documentation index, see [llms.txt](https://docs.rootcause.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rootcause.ai/more-details/applications/application-modules/aggregateforecast.md).

# Forecast Groups

> Roll a finished panel forecast up into named environment groups defined by a dimension column or SQL rules.

Rolls a per-environment forecast up into the groups a business actually reports on.

`grouping` picks how the groups are defined: `rules` evaluates each `where` clause in `rules` against the environment attributes, `dimension` groups by one column of them. `mode` is how member forecasts combine, and `includeOverall` adds one group holding everything.

## At a glance

|                          |                        |
| ------------------------ | ---------------------- |
| Module type              | `AggregateForecast`    |
| Category                 | Intelligence           |
| Default tier             | `reactive`             |
| Runs on                  | `reactive`, `durable`  |
| Starts a flow            | no                     |
| Holds a body             | no                     |
| Keeps state between runs | no                     |
| Available in             | every application type |

## Parameters

### `digitalTwinId`

`string` · required · defaults to `""`

The twin the forecast came from.

### `digitalTwinVersionIds`

`string[]` · required · defaults to `[]`

Pin to specific twin versions; empty means the latest.

### `environmentColumns`

`string[] | null` · required · defaults to `null`

Which columns of the attributes frame identify an environment.

### `mode`

`"sum" | "avg" | "min" | "max"` · required · defaults to `"sum"`

How member forecasts combine into a group's: sum them, or average them.

### `grouping`

`"rules" | "dimension"` · required · defaults to `"rules"`

Define groups by `rules`, or by the distinct values of `dimensionColumn`.

### `dimensionColumn`

`string | null` · required · defaults to `null`

The attribute column to group by, in `dimension` grouping.

### `rules`

`object[]` · required · defaults to `[]`

One named group per rule, each a `where` clause over the environment attributes.

### `includeOverall`

`boolean` · required · defaults to `false`

Add one further group holding every environment.

## Inputs

| Port         | Kind        | Required | Description                                                                                                                           |
| ------------ | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `on`         | `event`     | no       | Implicit on every module that does not itself start a flow: wire an event here to make this module the start of what that event runs. |
| `forecast`   | `dataframe` | yes      | The per-environment forecast to roll up.                                                                                              |
| `attributes` | `dataframe` | no       | One row per environment carrying the columns the rules read.                                                                          |

## Outputs

| Port         | Kind        | Connects to           | Description                                        |
| ------------ | ----------- | --------------------- | -------------------------------------------------- |
| `forecast`   | `dataframe` | `dataframe`, `signal` | One row per group, timestamp and metric.           |
| `membership` | `dataframe` | `dataframe`, `signal` | Which environments landed in which group, and why. |

***

[← All application modules](/more-details/applications/application-modules.md)
