Skip to content
@teakit/sheet documentation

Period rollups

Summarize a quarterly forecast by year.

Example

Create a range at the granularity of the input data. Quarter sheets have one row per year and four positions per row.

ts
import { Sheet } from "@teakit/sheet";

const quarters = Sheet.range("2025-Q1", "2025-Q4", { by: "quarter" }).fill(100);
const years = Sheet.rollup(quarters, { to: "year" });

The four quarterly amounts contribute to a single annual total of 400. For a partial year, aggregation skips missing positions and the no-data marker "-".