How to build Lago billing dashboards in Metabase
Lago is an open-source metering and usage-based billing platform — events, billable metrics, plans, invoices, and prepaid wallets. Metabase is where you turn that into shared dashboards for usage revenue, MRR, and invoicing. Because Metabase reads from SQL databases, the reliable way to connect them is a small pipeline: sync Lago into a database or warehouse on a schedule, then point Metabase at it. This guide walks through that path end to end — including a free option with no paid connector.
How do you connect Lago to Metabase?
Metabase connects to SQL databases and warehouses — not to SaaS APIs directly, and there's no native Lago connector. So connecting Lago to Metabase means one thing: run a small pipeline that copies Lago data into a database on a schedule, then connect Metabase to that database. If you self-host Lago, you can also point Metabase at a read replica of its Postgres. Once the data lands, the models, metrics, and SQL later in this guide all work.
The good news: this doesn't require a paid tool. Use a managed connector if you want zero maintenance, or a free, code-based sync you host yourself — both are covered in Build the pipeline below, and in more depth in our guide to building a data pipeline.
What can you analyze from Lago data in Metabase?
- Usage revenue — metered consumption by billable metric
- Recurring MRR — subscription plan charges over time
- Invoices and fees — invoiced revenue by fee type
- Wallets and credits — prepaid balance and consumption
- Overage — usage beyond included allowances
- Coupons and credits — discounts and their revenue impact
Which Lago dashboards should you build in Metabase?
Usage & billable metrics
What drives usage-based revenue.
- Metered usage by billable metric over time (line)
- Usage revenue by metric (bar)
- Customers by usage tier (table)
- Overage vs. included usage (stacked bar)
Recurring & total revenue
Recurring plan charges plus usage on top.
- MRR from recurring plan charges (number + trend)
- Recurring vs. usage revenue split (stacked bar)
- Net new MRR per month (bar)
- Revenue by plan (bar)
Invoices & fees
Billed amounts and their composition.
- Invoiced revenue by month (bar)
- Fees by type: subscription, charge, add-on (stacked bar)
- Invoice status and AR (table)
- Credits and coupons applied (table)
Wallets & prepaid credits
Prepaid balance and how fast it burns.
- Wallet balances outstanding (number)
- Credit top-ups vs. consumption (dual line)
- Burn rate by customer (table)
- Customers near zero balance (table)
How do you build the Lago → Metabase pipeline?
For dashboards that need history and reliability, land Lago data in a database first, then connect Metabase to that database.
Connector options
- dlt (free, code) — wrap the Lago API in a small Python pipeline for incremental, no-vendor loads. The lightest path to a maintainable sync.
- Lago API (free, raw) — paginate customers, subscriptions, invoices, fees, and wallets into your own pipeline.
- Webhooks (events) — stream invoice and subscription events into a table for near-real-time dashboards.
- Postgres read replica (self-hosted) — if you run Lago yourself, point Metabase at a read replica of its database.
Notes
- Land raw tables first, then build clean models on top.
- Amounts are in
_centsfields — divide in a model layer. - Keep usage (charge) fees separate from subscription fees.
- Model wallet balances and transactions separately from invoiced revenue.
Can you generate a Lago dashboard with AI?
Yes — and once Lago data is synced into a database, this is the fastest way to a strong first draft. First give an AI assistant a way to read your Metabase schema and create questions and dashboards, then paste the prompt below. It builds the dashboard from your database tables and tells the agent to skip metrics the schema can't support instead of faking them.
Two ways to let an assistant query and build in Metabase
Both connect to a Metabase instance that's already pointed at your synced database — the pipeline above moves the data; these just let the assistant read and write Metabase. Pick whichever fits your setup:
Metabase MCP
- Best for
- Chat clients (Claude, Cursor, Codex)
- Enable
- Admin → AI → MCP
- Endpoint
https://<your-metabase>/api/metabase-mcp- Auth
- OAuth handled by Metabase
Metabase CLI
- Best for
- Terminal agents, scripts, and CI
- Install
npm install -g @metabase/cli- Auth
- Browser OAuth (v62+) or an API key
- Docs
- @metabase/cli
Set up the Metabase MCP server
Enable it under Admin → AI → MCP, then point your client at the endpoint:
# Metabase built-in MCP (replace with your instance URL)
claude mcp add --transport http metabase https://your-metabase.example.com/api/metabase-mcp{
"mcpServers": {
"metabase": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-metabase.example.com/api/metabase-mcp"]
}
}
}Clients with native remote support can use a "url" field instead of the mcp-remote bridge. Confirm the current endpoint in the Metabase MCP docs.
Set up the Metabase CLI
Install it globally, then authenticate once (the binary is mb):
# Install the CLI (the binary is `mb`)
npm install -g @metabase/cli
# Authenticate once — opens your browser on Metabase v62+, or use an API key
mb auth login --url https://your-metabase.example.com
mb auth statusOn Metabase v62+ mb auth login opens your browser; older servers fall back to an API key. A terminal-based assistant can then inspect your schema (mb db schemas, mb table get --include fields) and create content (mb card create, mb dashboard create) against the synced tables.
Prompt: build the Lago Billing Overview dashboard
With MCP or the CLI connected, paste this into your assistant to generate the dashboard:
Create a polished Metabase dashboard for Lago usage-based billing analytics
using the available Lago tables in this database.
Goal: Help finance and product leaders understand usage-based revenue, recurring
MRR, invoices, and prepaid credit (wallet) consumption from Lago data.
First, inspect the schema and identify the available Lago tables. Do not assume
exact table names. Map the raw data into these analytical concepts where
possible: Customers, Subscriptions, Plans, Billable metrics, Events (usage),
Invoices, Fees, Wallets/Credits, and Coupons.
Important:
- Build the dashboard from durable database/warehouse tables (Lago API/webhooks,
or its Postgres if self-hosted).
- Separate recurring subscription revenue (MRR) from usage-based (metered)
revenue; document the rating logic.
- Report usage against included allowances so overage is visible.
- Track wallet (prepaid credit) balances and consumption separately.
- Report in a single reporting currency.
- Do not claim Metabase connects natively to Lago unless that is explicitly true
in this environment.
Dashboard title: Lago Billing Overview
Sections:
1. Executive summary (KPI cards): MRR; Usage revenue this month; Invoiced
revenue; Outstanding wallet balance; Net new MRR; Overage revenue.
2. Usage & billable metrics: Usage by metric over time; Usage revenue by metric;
Overage vs. included.
3. Recurring & total revenue: MRR from recurring charges; Recurring vs. usage
split; Revenue by plan.
4. Invoices & fees: Invoiced revenue; Fees by type; AR.
5. Wallets & credits: Wallet balances; Top-ups vs. consumption; Burn rate.
Filters: Plan, Billable metric, Customer, Currency, Date range.
Before finalizing, create or recommend reusable Metabase models:
modeled_lago_usage, modeled_lago_invoices, modeled_lago_wallets, and
modeled_lago_mrr (a monthly recurring-MRR model).
Output: Build the dashboard if you have permission; otherwise provide the exact
questions, SQL, model definitions, and layout. Include caveats for any metric
that cannot be calculated from the available schema. Reconcile totals against
Lago. Keep it practical, dense, and executive-readable. Avoid vanity metrics.How should you model Lago data in Metabase?
Core tables
| Concept | Grain | Key columns |
|---|---|---|
customers | one row per customer | id, external_id, created_at, currency |
subscriptions | one row per subscription | id, customer_id, plan_id, status, started_at, terminated_at |
billable_metrics | one row per metric | id, code, name, aggregation_type |
events | one row per usage event | transaction_id, external_subscription_id, code, properties, timestamp |
invoices | one row per invoice | id, customer_id, total_amount_cents, status, payment_status, issuing_date |
fees | one row per fee | id, invoice_id, charge_id, fee_type, amount_cents |
wallets | one row per wallet | id, customer_id, balance_cents, status |
Modeling advice
- Build a
modeled_lago_mrrtable from recurring subscription fees, excluding usage charges. - Keep usage rating in one model so overage and included allowances are auditable.
- Aggregate raw events to the billable-metric grain for usage analysis.
- Model wallets and wallet transactions separately from invoices.
- Reconcile modeled revenue against Lago before trusting the numbers.
Which Lago metrics should you track in Metabase?
| Metric | Definition | Notes |
|---|---|---|
| Usage revenue | Rated metered consumption (charge fees). | By billable metric. |
| MRR | Recurring subscription fees, normalized monthly. | Exclude usage charges. |
| Invoiced revenue | Total billed in a period. | Recognize per your accounting policy. |
| Overage revenue | Usage beyond included allowance. | Signals upsell opportunity. |
| Wallet balance | Outstanding prepaid credits. | Track consumption/burn rate. |
| Churn rate | Terminated ÷ active subscriptions. | Split voluntary vs. failed payment. |
What SQL powers Lago dashboards in Metabase?
These assume the modeled tables above (PostgreSQL dialect, amounts in cents). Adjust identifiers to match your schema.
Rated metered consumption, grouped by metric.
-- Metered usage revenue by billable metric
SELECT
date_trunc('month', f.created_at) AS month,
bm.name AS billable_metric,
ROUND(SUM(f.amount_cents) / 100.0, 2) AS usage_revenue
FROM fees f
JOIN charges c ON c.id = f.charge_id
JOIN billable_metrics bm ON bm.id = c.billable_metric_id
WHERE f.fee_type = 'charge'
GROUP BY 1, bm.name
ORDER BY 1, usage_revenue DESC;From subscription fees, excluding usage charges.
-- Recurring MRR from subscription fees (excludes usage charges)
SELECT
ROUND(SUM(mrr), 2) AS mrr,
ROUND(SUM(mrr) * 12, 2) AS arr,
COUNT(*) AS active_subscriptions
FROM modeled_lago_mrr
WHERE month = date_trunc('month', CURRENT_DATE);Prepaid credit outstanding and how much has been used.
-- Prepaid credit balance and consumption
SELECT
w.customer_id,
ROUND(w.balance_cents / 100.0, 2) AS balance,
ROUND(SUM(wt.credit_amount) FILTER (
WHERE wt.transaction_type = 'outbound') / 100.0, 2) AS consumed_credits
FROM wallets w
LEFT JOIN wallet_transactions wt ON wt.wallet_id = w.id
WHERE w.status = 'active'
GROUP BY w.customer_id, w.balance_cents
ORDER BY balance ASC;