Salesforce × Metabase

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.

Heads up: Metabase connects to databases and warehouses — it does not ship a native Salesforce connector. For dashboards that need history and reliability, you'll sync Salesforce into a database first (covered below).

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.

1 · MCP + CLI route (AI-assisted)

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.

Best for
  • 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
Trade-offs
  • 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
2 · Pipeline route (warehouse-backed)

Durable dashboards with history

Sync Salesforce into a database or warehouse with Airbyte, Fivetran, dlt, or the API, then point Metabase at it.

Best for
  • 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
Trade-offs
  • 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?

For: Sales leaders

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)
For: Sales ops, RevOps

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)
For: Revenue leadership

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)
For: Managers

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 csv to 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 replace or 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 csv needs 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)
Cursor~/.cursor/mcp.json or .cursor/mcp.json
{
  "mcpServers": {
    "salesforce": {
      "url": "https://api.salesforce.com/platform/mcp/v1/platform/sobject-reads",
      "auth": {
        "CLIENT_ID": "YOUR_CONSUMER_KEY"
      }
    }
  }
}
Sandbox / scratch org URL
# Sandbox / scratch orgs use the /sandbox/ path segment
https://api.salesforce.com/platform/mcp/v1/sandbox/platform/sobject-reads
TerminalLoad a Salesforce CSV with the Metabase CLI
# 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.csv

Enable 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.

Verify before shipping: confirm an uploads database is enabled under Admin → Settings → Uploads (Metabase docs) and the current Salesforce hosted MCP setup in the Salesforce docs. Prefer a read-only server and a least-privilege user for analysis.

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.

Prompt for creating a Salesforce Sales Overview dashboard
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 IsWon and IsClosed from 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

ObjectGrainKey columns
Opportunityone row per opportunityId, StageName, Amount, Probability, CreatedDate, CloseDate, IsWon, IsClosed, OwnerId, AccountId
OpportunityFieldHistoryone row per field changeOpportunityId, Field, OldValue, NewValue, CreatedDate
OpportunityStageone row per stageMasterLabel, SortOrder, DefaultProbability, IsWon, IsClosed
Accountone row per accountId, Name, Industry, OwnerId
Leadone row per leadId, Status, LeadSource, CreatedDate, ConvertedOpportunityId
Task / Eventone row per activityWhoId, WhatId, OwnerId, ActivityDate, Type

Modeling advice

  • Build a modeled_sfdc_opportunities table with clean is_won, is_closed, stage_name, amount,closed_at, and forecast_category.
  • Derive modeled_sfdc_stage_history from 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?

MetricDefinitionNotes
Open pipelineSum of Amount for open opportunities.Segment by stage, owner, forecast category.
Win rateWon ÷ closed opportunities in a cohort.Fix the denominator (closed vs. created) before comparing.
Sales cycle lengthCreate → close-won, in days.Report median and p90; it's right-skewed.
Stage conversionOpps reaching stage N+1 ÷ reaching stage N.Needs OpportunityFieldHistory.
Weighted pipelineSum of Amount × Probability.A rough forecast; compare to commit category.
Average deal sizeWon 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.

Win rate by monthPostgreSQL

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;
Open pipeline and weighted pipeline by stagePostgreSQL

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;
Sales cycle length (median and p90)PostgreSQL

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;

What are common mistakes when analyzing Salesforce in Metabase?

Treating a live MCP lookup or a one-off CSV as governed reporting.→ Use the Salesforce MCP and CSV uploads for live exploration; build warehouse-backed dashboards for anything people depend on.
Computing sales cycle without OpportunityFieldHistory.→ Sync stage field history — a current snapshot can't tell you when an opportunity entered or left a stage.
String-matching stage names for won/closed.→ Use IsWon / IsClosed from OpportunityStage; stage names get renamed and localized.
Ignoring multi-currency.→ If the org uses multi-currency, convert to one reporting currency before summing Amount.
Averaging deal size and cycle length.→ Both are right-skewed; report the median (and p90) alongside the mean.
Never reconciling with Salesforce reports.→ Sanity-check modeled pipeline and win rate against Salesforce's own reports before trusting them.

Related analytics

Related metrics

Related dashboards

Related integrations

FAQ

Does Metabase connect natively to Salesforce?
No. Metabase reads databases and warehouses. Sync Salesforce into a database first (Airbyte, Fivetran, dlt, or the API), then connect Metabase to that database.
Is there an official Salesforce MCP server?
Yes. Salesforce offers hosted MCP servers (generally available for Enterprise Edition and above) at api.salesforce.com/platform/mcp/v1/. Enable a server in Setup → API Catalog → MCP Servers, create an External Client App with mcp_api and refresh_token scopes, and connect your MCP client via OAuth. Start with the read-only sobject-reads server for analysis.
How do I quickly load Salesforce data without a warehouse?
Export a CSV from Salesforce and run `mb upload csv --file data.csv` with the Metabase CLI. It creates a table and a model you can build questions on right away. You'll need an uploads database enabled under Admin → Settings → Uploads. Refresh later with `mb upload replace`, or move to the pipeline route when you need history.
How do I calculate sales cycle length from Salesforce data?
Sync OpportunityFieldHistory for StageName, then measure days from CreatedDate to the close-won transition. Report the median and p90 rather than the average — the distribution is heavily right-skewed.