# iterating-with-previous-and-cycles

> Claude/Codex skill by [@gopigment](https://omgskills.com/library/gopigment/index.md) · 23 stars · Updated 2026-10-23

Execution skill. Use when writing PREVIOUS, PREVIOUSOF, or PREVIOUSBASE formulas, configuring iterative calculation cycles, or debugging circular dependency errors.

## Install

```sh
git clone https://github.com/gopigment/ai-plugins /tmp/ai-plugins && ln -s /tmp/ai-plugins/skills/iterating-with-previous-and-cycles ~/.claude/skills/iterating-with-previous-and-cycles
```

## From README

Iterating with PREVIOUS and Cycles Iterative calculations let a metric reference its own previous value along a dimension (typically time). Use them only for true metric-level circular dependencies; Pigment does not support cell-level circulars like Excel. Choose the Right Iterative Tool | Scope | Function | When to use | | --- | --- | --- | | Single block | PREVIOUS(Dimension \[, Offset\]) | All circular-referencing formulas are in one block | | Multiple blocks | PREVIOUSOF(Metric) | Circular references span different blocks; requires an iterative calculation cycle | Rule: loop within a single metric with PREVIOUS; loop across multiple metrics with PREVIOUSOF. PREVIOUSBASE is deprecated; use PREVIOUSOF instead. Write PREVIOUS Formulas Syntax: PREVIOUS(IteratingDimension \[, Offset\]) The argument is the iterating dimension, not the metric. Offset defaults to 1; can be a positive integer or an Integer metric on the same dimensions.

## Links

- HTML page: https://omgskills.com/library/gopigment/ai-plugins/skills/iterating-with-previous-and-cycles/
- GitHub: https://github.com/gopigment/ai-plugins
- Author: [@gopigment](https://omgskills.com/library/gopigment/index.md)

## More from this repo

- [aggregating-view-data](https://omgskills.com/library/gopigment/ai-plugins/skills/aggregating-view-data/index.md) — Execution skill.
   - [@gopigment](https://omgskills.com/library/gopigment/index.md) · 23 stars
- [architecting-multi-application-solutions](https://omgskills.com/library/gopigment/ai-plugins/skills/architecting-multi-application-solutions/index.md) — Planning skill.
   - [@gopigment](https://omgskills.com/library/gopigment/index.md) · 23 stars
- [auditing-a-pigment-application](https://omgskills.com/library/gopigment/ai-plugins/skills/auditing-a-pigment-application/index.md) — Execution skill.
   - [@gopigment](https://omgskills.com/library/gopigment/index.md) · 23 stars
