# C cohort retention 2

> Net revenue retention — monthly cohorts above 100%

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-cohort-retention-2).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-cohort-retention-2
- Screenshot: https://shadcn.exchange/shot/cnippet/c-cohort-retention-2/light.png
- Registry item: https://ui.cnippet.dev/r/c-cohort-retention-2.json
- Categories: cohort retention
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-cohort-retention-2.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/cohort-retention`, `@cnippet/chart-card`, `@cnippet/chart-utils`

## Files

### `registry/default/chart-variants/c-cohort-retention-2.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { CohortRetention } from "@/registry/default/charts/cohort-retention";
import { formatCurrency } from "@/registry/default/lib/chart-utils";

const months = ["May", "Jun", "Jul", "Aug", "Sep"];
const mrr = [42000, 51000, 47500, 58200, 61800];

// Deterministic net revenue retention: expansion pushes later months past 100%.
const data = months.map((cohort, c) => ({
  cohort,
  size: mrr[c] ?? 0,
  values: Array.from({ length: months.length - c }, (_, m) =>
    m === 0 ? 1 : +(0.94 + m * 0.035 + c * 0.01).toFixed(3),
  ),
}));

export default function RevenueRetention() {
  return (
    <ChartCard
      className="max-w-xl"
      description="Monthly recurring revenue kept from each cohort, including expansion"
      footer="Values over 100% mean upgrades outweighed churn."
      title="Net revenue retention"
    >
      <CohortRetention
        color="var(--chart-2)"
        data={data}
        periodLabel={(m) => `M${m}`}
        sizeFormatter={(v) => `${formatCurrency(v)} MRR`}
      />
    </ChartCard>
  );
}
```
