# Time aggregation & relative comparison (e.g. YoY)

## Time aggregation

In charts and tables, and in the roll-up columns in a spreadsheet, Causal can automatically **aggregate** a variable's values across time. For example: if your model is monthly and you have a **Revenue** variable, then Causal can automatically summarize the total revenue in each year.

The **Time Aggregation** function lets you choose how this summary is calculated. You can change the method by right-clicking on a variable and selecting **Aggregation Function** from the context menu -> **Time Aggregation,** or if you have Rollup columns toggled on you can click on a rollup cell to easily edit the **Time Aggregation** setting for each variable.

There are a few options:

**Sum**: this sums up the individual values. Examples:

- Anything that represents a discrete quantity which can accumulate, e.g. "Revenue"

**Average:** this calculates the mean of the individual values. Examples:

- Generally anything that's a percentage, like "Growth rate"

**Final:** this takes the final value in the set of individual values. Examples:

- Anything representing an accumulation, like "Total users" or "Cash in bank"
- A percentage that you expect to move roughly monotonically

**Initial:** just like final, but it takes takes the first value in the set of individual values.

**Formula:** uses the variable's formula to calculate an aggregation value. For example if you have a variable for the *margin* with the formula *profit / revenue*, the formula aggregation will take the total profit and divide it by the total revenue of the aggregated period.

Note that the **Time Aggregation** setting of a variable also determines how a variable is 'rolled up' to a model with a higher-level granularity. For example if you have a Weekly model, and then a Monthly model pulls in a variable from the Weekly model, should it pull the sum, the average, the final...?

## Relative comparison

You can easily compare the value of a variable across relative time periods (e.g. the prior month, the prior year). The comparison is shown on a time aggregated basis too, if relevant. For example, if your model is monthly and you've set your table to Yearly time aggregation, a YoY comparison will show for 2022 vs. 2021, as well as each month (e.g. Jan 2022 vs. Jan 2021).