Most companies track their KPIs in spreadsheets that someone updates manually every Monday morning. Someone exports data from the database, pastes it into a sheet, refreshes a pivot table, and emails a screenshot to leadership. By the time the numbers reach the people who need them, they're already 48 hours stale.
The irony is that your database already has every number you need revenue, user counts, churn rate, conversion rates updated in real time. The gap isn't data. It's access.
This guide walks through how to build a live KPI tracker that pulls directly from your database, stays current automatically, and doesn't require a data analyst or BI engineer to maintain.
What Makes a Good KPI Tracker
Before getting into the mechanics, it's worth being precise about what you actually want. A KPI tracker that's useful has three characteristics:
Live data. If your KPIs are 24+ hours stale, decisions get made on yesterday's reality. The tracker should reflect what's happening now, or at minimum within the last hour.
Stable definitions. "Active users" means different things to different people. Your tracker needs to lock in definitions so the same number appears every time not a different answer depending on who ran the query.
Zero-maintenance operation. If a human has to do anything for the dashboard to stay current, it will eventually break. Someone takes a vacation, the spreadsheet gets corrupted, the analyst leaves. The tracker needs to refresh itself.
Most BI tools Metabase, Tableau, Looker can theoretically do all three. In practice, they require significant setup, someone to write the queries, and ongoing maintenance. That's fine if you have a dedicated data team. If you don't, you need a lighter path.
Step 1: Identify the 5-10 KPIs That Actually Matter
The biggest mistake in KPI tracker design is including too many metrics. When everything is tracked, nothing is actionable.
Start with the question: what are the 5-10 numbers that would cause you to change your behavior if they moved by 10%? Those are your real KPIs.
Common choices by company type:
SaaS:
E-commerce:
Marketplace:
Write these down before touching any tooling. Once you know what you need, finding it in your database is the straightforward part.
Step 2: Find the Right Tables in Your Database
Every KPI lives somewhere in your database. The trick is knowing which tables and which fields map to which metrics.
For a SaaS application on PostgreSQL, a typical schema might look like this:
Users and their subscription status
users (id, email, created_at, plan, status, trial_ends_at)
Subscription events log
subscription_events (id, user_id, event_type, mrr_change, occurred_at)
User sessions/activity
user_sessions (id, user_id, started_at, ended_at)From these three tables, you can derive most standard SaaS KPIs. For example, current MRR:
SELECT
SUM(CASE WHEN event_type = 'subscription_started' THEN mrr_change
WHEN event_type = 'subscription_cancelled' THEN -mrr_change
ELSE 0 END) AS current_mrr
FROM subscription_events;Or daily active users for the last 30 days:
SELECT
DATE(started_at) AS day,
COUNT(DISTINCT user_id) AS dau
FROM user_sessions
WHERE started_at >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY DATE(started_at)
ORDER BY day;This is where non-technical founders typically hit a wall. They know what they want to see. They don't know how to get it. That's a legitimate problem and it's one that AI for Database solves directly. Instead of writing those queries yourself, you describe what you want: "Show me DAU for the last 30 days" and the system writes the SQL, runs it, and displays the result.
Step 3: Define Each Metric Precisely in Query Form
The most common source of confusion in KPI reporting is ambiguity in metric definitions. Two people ask for "revenue this month" and get different numbers because one includes refunds and one doesn't. One counts trials, one doesn't.
The solution is to write or generate the exact query for each KPI and document it. Once the query is set, the metric definition is locked. Anyone looking at that number is seeing the same thing.
Here's an example for churn rate:
Monthly churn rate: cancelled subscriptions / subscriptions at start of month
WITH month_start AS (
SELECT COUNT(*) AS active_at_start
FROM users
WHERE status = 'active'
AND created_at < DATE_TRUNC('month', CURRENT_DATE)
),
churned AS (
SELECT COUNT(*) AS churned_count
FROM subscription_events
WHERE event_type = 'subscription_cancelled'
AND occurred_at >= DATE_TRUNC('month', CURRENT_DATE)
AND occurred_at < DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month'
)
SELECT
ROUND(churned_count::numeric / active_at_start * 100, 2) AS monthly_churn_rate_pct
FROM month_start, churned;Write one query per KPI. Keep them in a shared document or in your database tool of choice. These queries become the source of truth for your entire organization.
Step 4: Set Up Auto-Refreshing Dashboards
Writing queries once is the easy part. Making them run automatically and keeping the results visible without anyone hitting "refresh" is where most setups fall apart.
Options for auto-refresh:
Scheduled exports to Google Sheets: You can set up a cron job or a Zapier/Make automation to run queries on a schedule and dump results into a spreadsheet. This works, but it's brittle exports break, authentication tokens expire, someone edits the sheet structure.
BI tool scheduled refreshes: Metabase and similar tools can schedule query refreshes. They require someone to set up the queries in the first place and maintain the tool.
AI for Database dashboards: You describe what you want to see in plain English, and the tool creates a dashboard that refreshes automatically. No SQL required from your side, no export pipeline to maintain. You can set refresh intervals hourly, daily, or on-demand and the dashboard stays current without anyone touching it.
The key principle: any refresh process that requires a human step will eventually fail. Build a fully automated pipeline from day one.
Step 5: Add Alerting for Critical KPI Thresholds
A live dashboard solves the "I need to find the number" problem. But for truly operational KPI tracking, you want the numbers to come to you when something unusual happens not just when you think to check.
This means setting up threshold alerts:
The query for a signup drop alert might look like this:
WITH seven_day_avg AS (
SELECT AVG(daily_count) AS avg_signups
FROM (
SELECT DATE(created_at) AS day, COUNT(*) AS daily_count
FROM users
WHERE created_at >= CURRENT_DATE - INTERVAL '8 days'
AND created_at < CURRENT_DATE
GROUP BY DATE(created_at)
) past_week
),
today AS (
SELECT COUNT(*) AS today_count
FROM users
WHERE created_at >= CURRENT_DATE
)
SELECT
today_count,
avg_signups,
ROUND((today_count - avg_signups) / avg_signups * 100, 1) AS pct_change
FROM today, seven_day_avg
WHERE today_count < avg_signups * 0.8;
If this query returns a row, signups are more than 20% below averageWith AI for Database action workflows, you define conditions like this in plain English "alert me when signups drop more than 20% below the 7-day average" and the system handles the monitoring and notification automatically.
Step 6: Share Access With Your Team
A KPI tracker that only one person can see isn't a tracker it's a personal dashboard. The goal is to make these numbers accessible to everyone who needs them without requiring SQL skills.
The access model should be:
This is the shift from database-as-a-silo to database-as-a-shared-resource. The data team or the single person wearing that hat at a startup becomes a platform rather than a bottleneck.
Common Mistakes to Avoid
Tracking too many KPIs. If your dashboard has 40 metrics, none of them are KPIs. Cut to the numbers that drive decisions.
Inconsistent definitions. If "active user" means something different in three different dashboards, you'll have unproductive arguments about which number is right. Define it once, enforce it everywhere.
Forgetting timezone handling. If your users span timezones and your database stores timestamps in UTC, "daily active users" can produce confusing results at day boundaries. Always be explicit:
WHERE started_at >= DATE_TRUNC('day', CURRENT_TIMESTAMP AT TIME ZONE 'America/New_York')Ignoring query performance. A dashboard that takes 3 minutes to load doesn't get used. If your queries are slow, add indexes on date and foreign key columns, and consider materialized views for complex aggregations.
Getting Started Today
The fastest path to a working KPI tracker: pick your 5 most important metrics, find where they live in your database, and get a dashboard running today even a rough one.
If you already know SQL, write the queries yourself and set up a scheduled refresh. If you don't, connect your database to AI for Database, describe what you want to see, and have a live dashboard within an hour. Once you have it, set up alerts for the metrics that matter most. Then refine from there.
The goal is a single, trustworthy place where anyone on your team can see how the business is performing right now not yesterday, not last week, but now. Your database already has that data. The only question is whether you've made it accessible.
Try AI for Database free at aifordatabase.com.