How to build Salesforce sales dashboards in Metabase
Salesforce is where your leads, accounts, and opportunities live. Metabase is where you turn that pipeline activity into shared, trustworthy sales dashboards. This guide covers two complementary paths: a lightweight MCP + CLI route that pulls live data with a Salesforce hosted MCP server and loads a CSV into Metabase with the Metabase CLI for quick analysis, and a durable pipeline route that syncs Salesforce into a database so you can build pipeline, win-rate, and forecast dashboards anyone can read.
How do you connect Salesforce to Metabase?
Most teams combine both routes: use a Salesforce hosted MCP server and Metabase CLI route to pull live data and stand up a quick analysis, and the pipeline route for the sales dashboards leadership depends on.
Live data in, quick analysis out
Pair a Salesforce hosted MCP server (to read live accounts, opportunities, and activities) with the Metabase CLI, whose upload command loads a CSV into Metabase as a ready-to-query table and model.
- Quick lookups like "which opportunities pushed to next quarter?"
- Loading a Salesforce CSV export into Metabase in seconds
- Spot-checks and one-off analyses without a warehouse
- Great for exploration, not governed reporting
- Prefer a read-only Salesforce MCP server to avoid accidental writes
- CSV uploads are snapshots — refresh or move to the pipeline for history
Durable dashboards with history
Sync Salesforce into a database or warehouse with Airbyte, Fivetran, dlt, or the API, then point Metabase at it.
- Pipeline, win-rate, and forecast dashboards the whole org relies on
- Sales cycle and stage-conversion trends over quarters and years
- Joining CRM data with product usage, billing, or support data
- Requires a destination database and a sync to maintain
- You own the stage and win definitions and the refresh schedule
- Sync OpportunityFieldHistory if you want accurate velocity metrics
What can you analyze from Salesforce data in Metabase?
- Pipeline — open value by stage, owner, and segment, plus coverage against quota
- Win rate — opportunities won vs. closed, by cohort, source, and stage entered
- Sales cycle length — create to close-won, with median and p90
- Stage conversion — where opportunities advance and where they stall
- Forecast — weighted and unweighted pipeline by forecast category
- Deal size — average and median ACV, plus mix by segment
- Activity — tasks and events by rep and account
Which Salesforce dashboards should you build in Metabase?
Pipeline
The open book of business, right now.
- Open pipeline by stage (funnel)
- Pipeline by owner and segment (bar)
- Coverage vs. quota for the period (number)
- Aging opportunities and past-due close dates (table)
Forecast
What's likely to land this period.
- Weighted vs. unweighted pipeline for the quarter (number)
- Forecast category: commit / best case / pipeline (bar)
- Opportunities expected to close by week (line)
- Slipped opportunities (close date pushed) (table)
Win rate & conversion
How reliably opportunities we work close.
- Win rate by month and segment (line)
- Stage-to-stage conversion (funnel)
- Win rate by lead source and by owner (bar)
- Loss reasons breakdown (bar)
Sales activity
Effort and coverage, not surveillance.
- Tasks and events by rep (bar)
- Activities per open opportunity (number)
- Accounts touched this week (number)
- New-lead response time (line)
How do you use the Salesforce MCP server with the Metabase CLI?
Pair a Salesforce hosted MCP server with the Metabase CLI for fast, hands-on analysis. The Salesforce MCP looks up current accounts, opportunities, and activities; the Metabase CLI's upload command loads a CSV into Metabase and creates a ready-to-query table and model. For analysis, start with a read-only server.
Example workflow
- Ask the Salesforce MCP which opportunities pushed their close date, or an account's open opportunities and recent tasks.
- Export the opportunities or activity you want to keep as a CSV.
- Run
mb upload csvto load it into Metabase as a table and model, then build questions and dashboards on top.
Be honest about the limits
- The Salesforce MCP is great for live lookups — not for scheduled or audited pipeline reporting.
- A CSV upload is a point-in-time snapshot; refresh it with
mb upload replaceor move to the pipeline for real history — sales cycle and stage conversion still need synced field history. - Access is governed by the org: the server enforces the connected user's permissions and sharing rules — prefer a read-only server.
mb upload csvneeds an uploads database configured under Admin → Settings → Uploads.
How do you set up the Salesforce MCP server and the Metabase CLI?
Salesforce MCPofficial
- Endpoint
api.salesforce.com/platform/mcp/v1/<server>- Transport
- Remote (Streamable HTTP)
- Auth
- OAuth via an External Client App
- Enable
- Setup → API Catalog → MCP Servers
Metabase CLIofficial
- Install
npm install -g @metabase/cli- Auth
mb auth login(browser OAuth on v62+, or an API key)- Load data
mb upload csv --file data.csv- Requires
- An uploads database (Admin → Settings → Uploads)
{
"mcpServers": {
"salesforce": {
"url": "https://api.salesforce.com/platform/mcp/v1/platform/sobject-reads",
"auth": {
"CLIENT_ID": "YOUR_CONSUMER_KEY"
}
}
}
}# Sandbox / scratch orgs use the /sandbox/ path segment
https://api.salesforce.com/platform/mcp/v1/sandbox/platform/sobject-reads# Install the Metabase CLI
npm install -g @metabase/cli
# Log in (opens your browser; requires Metabase v62+)
mb auth login --url https://your-metabase.example.com
# Load a Salesforce CSV export — creates a table AND a model
mb upload csv --file salesforce-opportunities.csv --collection root
# Refresh that same table later from a new export
mb upload replace <table-id> --file salesforce-opportunities.csvEnable a server (for analysis, start with the read-only platform/sobject-reads server), create an External Client App with the mcp_api and refresh_token scopes, set the Cursor callback URL, then use the app's consumer key as CLIENT_ID. The Metabase CLI stores its credentials securely after mb auth login.
Can you generate a Salesforce dashboard with AI?
Yes. Use the prompt below with any assistant that can run the Salesforce MCP server and the Metabase CLI. It works end to end: if Salesforce tables already exist in Metabase it analyzes those; otherwise it pulls the data over the Salesforce MCP, loads it with mb upload csv, then builds the dashboard — defining "won" and "closed" and skipping metrics the data can't support instead of faking them.
Create a polished Metabase dashboard for Salesforce sales analytics.
Work end to end: get the data into Metabase if it isn't there yet, then build.
Goal: Help sales leaders understand pipeline, forecast, win rate, sales cycle,
and rep activity from Salesforce CRM data.
Step 1 — Find or load the data:
- First, check what already exists in Metabase (search for Salesforce tables and
models). If durable Salesforce data is already present — synced from a
warehouse or uploaded earlier — use it and skip to Step 2.
- If nothing is there, pull it with the Salesforce hosted MCP server (read-only
where supported): opportunities, opportunity stages, accounts, activities, and
users. Write each result to a CSV, then load it with the Metabase CLI — run
"mb upload csv --file <export>.csv" so each upload creates a table and a
ready-to-query model. Use "mb upload replace <table-id> --file <export>.csv" to
refresh an existing table instead of creating duplicates.
Step 2 — Inspect before querying:
Salesforce CSV exports are usually flat and pre-aggregated (one row per
opportunity or account, with columns like stage, amount, close date, and owner).
Warehouse tables are raw and include OpportunityFieldHistory for velocity
metrics. Inspect the actual tables and column names first; do not assume exact
names or that stage history exists.
Important:
- Build on whatever data is present; don't claim Metabase connects natively to
Salesforce — it reads a database or CLI-uploaded tables.
- Only recompute rates over the correct base (e.g. win rate) when raw counts are
available; if the data already provides a rate, chart it directly.
- Define "won" and "closed" once (IsWon vs. IsClosed) and reuse the definitions.
- For win rate, state the denominator explicitly (won / closed vs. won / created)
and hold the cohort fixed.
- Report sales cycle length and deal size as medians (p50) and p90, never plain
averages — both are right-skewed.
- If OpportunityFieldHistory (stage history) is missing, do not calculate sales
cycle length, time-in-stage, or stage conversion. Use a caveat instead.
- Convert all amounts to a single reporting currency; caveat any mix.
- Only build a card if its underlying column/metric exists in the data.
- A single CSV is a point-in-time snapshot: only build trend cards if there is a
usable date column or multiple periods have been uploaded.
Dashboard title: Salesforce Sales Overview
Sections:
1. Executive summary (KPI cards): Open pipeline; Pipeline coverage vs. quota;
Win rate (last 90 days); Median sales cycle length; Average and median deal
size; Opportunities closing this period.
2. Pipeline: Open pipeline by stage; by owner and segment; aging and past-due
close dates.
3. Forecast: Weighted vs. unweighted pipeline; forecast category; opportunities
expected to close by week; slipped opportunities.
4. Win rate & conversion: Win rate by month and segment; stage-to-stage
conversion; loss reasons.
5. Activity: Tasks/events by rep; activities per open opportunity; new-lead
response time.
Filters: Stage, Owner, Segment/Industry, Lead source, Forecast category, Date
range.
Reuse the models Metabase auto-created from uploaded CSVs, or (for a warehouse)
create reusable models: modeled_sfdc_opportunities, modeled_sfdc_accounts,
modeled_sfdc_stage_history, modeled_sfdc_activities, and modeled_sfdc_users.
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 data. Reconcile totals against
Salesforce reports. Keep it practical, dense, and executive-readable. Avoid
vanity metrics.How do you sync Salesforce data into a database or warehouse?
For dashboards that need history and reliability, land Salesforce data in a database first, then connect Metabase to that database.
Connector options
- Airbyte (managed ETL) — has a Salesforce source covering standard and custom objects, including OpportunityFieldHistory.
- Fivetran (managed ETL) — offers a maintained Salesforce connector with history-mode and incremental syncs.
- dlt (code) — a verified Salesforce source for a Python pipeline when you want full control.
- Salesforce API (raw) — the source of truth; use the Bulk API and query OpportunityFieldHistory for stage changes.
Notes
- Land raw tables first, then build clean models on top.
- Sync OpportunityFieldHistory for StageName if you want sales cycle length, time-in-stage, and stage conversion.
- Use
IsWonandIsClosedfrom OpportunityStage rather than string-matching stage names. - Handle multi-currency: if the org uses it, convert with CurrencyType / DatedConversionRate to one reporting currency.
How should you model Salesforce data in Metabase?
Core tables
| Object | Grain | Key columns |
|---|---|---|
Opportunity | one row per opportunity | Id, StageName, Amount, Probability, CreatedDate, CloseDate, IsWon, IsClosed, OwnerId, AccountId |
OpportunityFieldHistory | one row per field change | OpportunityId, Field, OldValue, NewValue, CreatedDate |
OpportunityStage | one row per stage | MasterLabel, SortOrder, DefaultProbability, IsWon, IsClosed |
Account | one row per account | Id, Name, Industry, OwnerId |
Lead | one row per lead | Id, Status, LeadSource, CreatedDate, ConvertedOpportunityId |
Task / Event | one row per activity | WhoId, WhatId, OwnerId, ActivityDate, Type |
Modeling advice
- Build a
modeled_sfdc_opportunitiestable with cleanis_won,is_closed,stage_name,amount,closed_at, andforecast_category. - Derive
modeled_sfdc_stage_historyfrom OpportunityFieldHistory (Field = 'StageName') for time-in-stage and cycle length. - Join OpportunityStage to get SortOrder / probability so funnels order correctly.
- Resolve OwnerId to User names once, in a model, and roll up to teams.
- Reconcile modeled pipeline and win rate against Salesforce reports before anyone trusts the numbers.
Which Salesforce metrics should you track in Metabase?
| Metric | Definition | Notes |
|---|---|---|
| Open pipeline | Sum of Amount for open opportunities. | Segment by stage, owner, forecast category. |
| Win rate | Won ÷ closed opportunities in a cohort. | Fix the denominator (closed vs. created) before comparing. |
| Sales cycle length | Create → close-won, in days. | Report median and p90; it's right-skewed. |
| Stage conversion | Opps reaching stage N+1 ÷ reaching stage N. | Needs OpportunityFieldHistory. |
| Weighted pipeline | Sum of Amount × Probability. | A rough forecast; compare to commit category. |
| Average deal size | Won Amount ÷ won opportunities. | Report the median too; outliers distort the mean. |
What SQL powers Salesforce dashboards in Metabase?
These assume the modeled tables above (PostgreSQL dialect). Adjust identifiers to match your warehouse.
Won as a share of closed opportunities over the last 12 months.
SELECT
date_trunc('month', o.close_date) AS month,
COUNT(*) FILTER (WHERE o.is_won) AS won,
COUNT(*) FILTER (WHERE o.is_closed) AS closed,
ROUND(
100.0 * COUNT(*) FILTER (WHERE o.is_won)
/ NULLIF(COUNT(*) FILTER (WHERE o.is_closed), 0),
1
) AS win_rate_pct
FROM modeled_sfdc_opportunities o
WHERE o.is_closed
AND o.close_date >= CURRENT_DATE - INTERVAL '12 months'
GROUP BY 1
ORDER BY 1;The current funnel plus a probability-weighted forecast.
SELECT
o.stage_name,
o.forecast_category,
COUNT(*) AS open_opps,
ROUND(SUM(o.amount), 2) AS open_amount,
ROUND(SUM(o.amount * o.probability / 100.0), 2) AS weighted_amount
FROM modeled_sfdc_opportunities o
WHERE NOT o.is_closed
GROUP BY o.stage_name, o.forecast_category
ORDER BY open_amount DESC;Days from create to close-won; medians beat averages here.
-- Median days from create to close-won, by month closed
SELECT
date_trunc('month', o.close_date) AS month,
percentile_cont(0.5) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (o.closed_at - o.created_date)) / 86400.0
) AS median_cycle_days,
percentile_cont(0.9) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (o.closed_at - o.created_date)) / 86400.0
) AS p90_cycle_days
FROM modeled_sfdc_opportunities o
WHERE o.is_won
GROUP BY 1
ORDER BY 1;