← Back to all products

Metric Calculator

$19

SaaS metrics library: MRR, ARR, churn rate, LTV, CAC, NPS, net revenue retention, and quick ratio.

📁 10 files
JSONMarkdownPythonExcel

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 10 files

metric-calculator/ ├── LICENSE ├── README.md ├── examples/ │ └── sample_subscriptions.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_quick-start.md │ ├── 03_metrics-reference.md │ └── 04_license.md ├── index.html └── src/ └── metric_calculator.py

📖 Documentation Preview README excerpt

Metric Calculator

SaaS metrics library: MRR, ARR, churn rate, LTV, CAC, NPS, net revenue retention, quick ratio, and more. Feed it subscription data and get actionable business metrics with trend detection.

Features

  • 12+ SaaS metrics — MRR, ARR, ARPU, churn, revenue churn, NRR, LTV, CAC, LTV:CAC ratio, quick ratio, NPS, payback period
  • Trend detection — Period-over-period change tracking with direction indicators
  • Healthy range indicators — Know if your metrics are in the good, warning, or danger zone
  • Multi-period analysis — Track metrics across months to spot trends
  • Formula documentation — Every metric function explains WHY it matters, not just how to calculate it
  • Pretty terminal output — Formatted metrics table with arrows and ranges
  • JSON export — Machine-readable output for dashboards and automation

Requirements

  • Python 3.10+
  • No external dependencies (stdlib only)

Quick Start


# Calculate all metrics for the latest period
python src/metric_calculator.py --data examples/sample_subscriptions.json

# Show last 6 periods with trends
python src/metric_calculator.py --data examples/sample_subscriptions.json --periods 6

# Include CAC (provide total acquisition spend)
python src/metric_calculator.py --data examples/sample_subscriptions.json --acquisition-cost 15000

# Export to JSON
python src/metric_calculator.py --data data.json --output metrics_report.json

Input Format

JSON or CSV with period-level subscription data:


[
    {
        "period": "2026-01",
        "mrr": 42500,
        "new_mrr": 5200,
        "expansion_mrr": 1800,
        "contraction_mrr": 400,
        "churned_mrr": 1200,
        "total_customers": 185,
        "new_customers": 32,
        "churned_customers": 4,
        "revenue": 42500
    }
]

Metrics Reference

MetricFormulaHealthy Range

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/metric_calculator.py #!/usr/bin/env python3 """ Metric Calculator — Analytics Hub (DataNest) SaaS metrics library: MRR, ARR, churn rate, LTV, CAC, NPS, net revenue retention, quick ratio, and more. Feed it subscription data and get actionable business metrics with trend detection. Usage: python metric_calculator.py --data subscriptions.json --metric all python metric_calculator.py --data revenue.csv --metric mrr --output report.json python metric_calculator.py --data subscriptions.json --metric churn --periods 6 Dependencies: Python 3.10+ stdlib only (no pip packages) License: MIT """ from __future__ import annotations import argparse import csv import json import logging import math import sys from dataclasses import dataclass, field from datetime import datetime, timezone from pathlib import Path from typing import Any logger = logging.getLogger("metric_calculator") # --------------------------------------------------------------------------- # Data models # --------------------------------------------------------------------------- @dataclass class MetricValue: """A single metric measurement with optional trend data.""" name: str value: float formatted: str description: str trend: float | None = None # Period-over-period change percentage trend_direction: str = "" # "up", "down", "flat" healthy_range: str = "" # e.g. "< 5%", "> 100%" def to_dict(self) -> dict[str, Any]: d: dict[str, Any] = { "name": self.name, "value": self.value, # ... 461 more lines ...
Buy Now — $19 Back to Products