DEV Community

Michael
Michael

Posted on • Originally published at getmichaelai.com

Ditch the Guesswork: 7 B2B Sales Metrics You Can Code for Predictable Growth

As developers and builders, we hate black boxes. We want to instrument, monitor, and debug our systems. So why do we often treat our sales funnel like a mysterious monolith? When revenue is unpredictable, it feels like you're just shipping code to production and hoping for the best.

It doesn't have to be this way. You can apply the same engineering principles you use for building software to building your business. By tracking the right metrics, you can turn your sales process from a black box into a transparent, debuggable data pipeline.

Let's break down 7 essential B2B sales funnel metrics you can start tracking today. I'll even throw in some JavaScript snippets to show how you can calculate them.

1. Lead Velocity Rate (LVR)

Think of LVR as the git log for your future revenue. It's a leading indicator that measures the month-over-month growth of your qualified leads. If your qualified leads are growing at 15% MoM, your revenue is likely to follow suit in a few months.

Why it matters: It's one of the best predictors of future growth. A high LVR signals a healthy top-of-funnel and strong future sales.

How to Calculate It

/**
 * Calculates Lead Velocity Rate (LVR).
 * @param {number} currentMonthLeads - Number of qualified leads this month.
 * @param {number} previousMonthLeads - Number of qualified leads last month.
 * @returns {string} The LVR as a percentage string.
 */
const calculateLVR = (currentMonthLeads, previousMonthLeads) => {
  if (previousMonthLeads === 0) {
    return "Cannot calculate LVR from a zero baseline.";
  }
  const lvr = ((currentMonthLeads - previousMonthLeads) / previousMonthLeads) * 100;
  return `${lvr.toFixed(2)}%`;
};

// Example:
const qualifiedLeadsThisMonth = 115;
const qualifiedLeadsLastMonth = 100;

console.log(`Lead Velocity Rate: ${calculateLVR(qualifiedLeadsThisMonth, qualifiedLeadsLastMonth)}`);
// Output: Lead Velocity Rate: 15.00%
Enter fullscreen mode Exit fullscreen mode

2. MQL-to-SQL Conversion Rate

This is the API contract between your Marketing and Sales teams. A Marketing Qualified Lead (MQL) is someone who has shown interest (e.g., downloaded an ebook). A Sales Qualified Lead (SQL) is an MQL that the sales team has vetted and confirmed is a legitimate potential customer. This metric tells you if Marketing is sending valid payloads to Sales.

Why it matters: A low conversion rate here might mean your marketing message is attracting the wrong audience, or your definition of a 'qualified' lead is misaligned.

How to Calculate It

/**
 * Calculates the conversion rate from MQL to SQL.
 * @param {number} totalSQLs - Total number of Sales Qualified Leads.
 * @param {number} totalMQLs - Total number of Marketing Qualified Leads.
 * @returns {string} The conversion rate as a percentage.
 */
const calculateMQLtoSQLRate = (totalSQLs, totalMQLs) => {
  if (totalMQLs === 0) {
    return "0.00%";
  }
  const rate = (totalSQLs / totalMQLs) * 100;
  return `${rate.toFixed(2)}%`;
};

// Example:
const mqlsGenerated = 500;
const sqlsAccepted = 75;

console.log(`MQL to SQL Rate: ${calculateMQLtoSQLRate(sqlsAccepted, mqlsGenerated)}`);
// Output: MQL to SQL Rate: 15.00%
Enter fullscreen mode Exit fullscreen mode

3. Opportunity Win Rate (Close Rate)

This is the bottom-of-the-funnel metric everyone knows: of the real, qualified opportunities your sales team works on, how many become paying customers? It's the final return true of your sales process.

Why it matters: It's the ultimate measure of your sales team's effectiveness in demonstrating value and closing deals.

How to Calculate It

/**
 * Calculates the Opportunity Win Rate.
 * @param {number} dealsWon - The number of closed-won deals.
 * @param {number} totalOpportunities - The total number of deals (won and lost).
 * @returns {string} The win rate as a percentage.
 */
const calculateWinRate = (dealsWon, totalOpportunities) => {
  if (totalOpportunities === 0) {
    return "0.00%";
  }
  const rate = (dealsWon / totalOpportunities) * 100;
  return `${rate.toFixed(2)}%`;
};

// Example:
const opportunitiesCreated = 50;
const customersWon = 12;

console.log(`Win Rate: ${calculateWinRate(customersWon, opportunitiesCreated)}`);
// Output: Win Rate: 24.00%
Enter fullscreen mode Exit fullscreen mode

4. Average Deal Size

This is straightforward: what's the average revenue you generate from a new customer? Knowing this helps you determine how many deals you need to hit your revenue targets.

Why it matters: Tracking this helps with sales forecasting and understanding which customer segments are most valuable. An increasing average deal size is a great sign of health.

How to Calculate It

/**
 * Calculates the average deal size from an array of deals.
 * @param {Array<object>} wonDeals - An array of deal objects, each with a 'value' property.
 * @returns {string} The average deal size formatted as a currency string.
 */
const calculateAverageDealSize = (wonDeals) => {
  if (wonDeals.length === 0) {
    return '$0.00';
  }
  const totalValue = wonDeals.reduce((sum, deal) => sum + deal.value, 0);
  const average = totalValue / wonDeals.length;
  return `$${average.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
};

// Example:
const closedDeals = [
  { id: 'deal-1', value: 25000 },
  { id: 'deal-2', value: 35000 },
  { id: 'deal-3', value: 30000 },
];

console.log(`Average Deal Size: ${calculateAverageDealSize(closedDeals)}`);
// Output: Average Deal Size: $30,000.00
Enter fullscreen mode Exit fullscreen mode

5. Sales Cycle Length

How long does a request take to process? In sales, this is the time from first serious contact (like an SQL) to a signed contract. It's a measure of your sales process latency.

Why it matters: A long sales cycle can kill your cash flow and make forecasting difficult. Tracking and shortening it is a huge lever for growth.

How to Calculate It

/**
 * Calculates the average sales cycle length in days.
 * @param {Array<object>} wonDeals - Array of deals, each with 'createdAt' and 'closedAt' Date objects.
 * @returns {string} The average number of days in the sales cycle.
 */
const calculateSalesCycleLength = (wonDeals) => {
  if (wonDeals.length === 0) {
    return 'N/A';
  }
  const oneDay = 1000 * 60 * 60 * 24; // milliseconds in a day
  const totalDuration = wonDeals.reduce((sum, deal) => {
    const duration = deal.closedAt.getTime() - deal.createdAt.getTime();
    return sum + duration;
  }, 0);

  const averageDurationMs = totalDuration / wonDeals.length;
  const averageDays = Math.round(averageDurationMs / oneDay);

  return `${averageDays} days`;
};

// Example:
const dealHistory = [
  { createdAt: new Date('2023-01-15'), closedAt: new Date('2023-03-20') }, // 64 days
  { createdAt: new Date('2023-02-01'), closedAt: new Date('2023-04-10') }, // 68 days
  { createdAt: new Date('2023-02-10'), closedAt: new Date('2023-04-05') }, // 54 days
];

console.log(`Average Sales Cycle: ${calculateSalesCycleLength(dealHistory)}`);
// Output: Average Sales Cycle: 62 days
Enter fullscreen mode Exit fullscreen mode

6. Full Funnel Conversion Rate

This is your end-to-end test. From all the leads that enter the top of your funnel (MQLs), what percentage eventually become customers? It gives you a holistic view of your sales and marketing efficiency.

Why it matters: It answers the crucial question: "If we generate 1,000 leads, how many customers can we expect?" This is gold for planning and forecasting.

How to Calculate It

/**
 * Calculates the overall conversion rate from MQL to Won Deal.
 * @param {number} dealsWon - Total number of closed-won deals in a period.
 * @param {number} totalMQLs - Total number of MQLs generated in that period.
 * @returns {string} The full funnel conversion rate as a percentage.
 */
const calculateFullFunnelRate = (dealsWon, totalMQLs) => {
  if (totalMQLs === 0) {
    return '0.00%';
  }
  const rate = (dealsWon / totalMQLs) * 100;
  return `${rate.toFixed(2)}%`;
};

// Example from our previous numbers:
console.log(`Full Funnel Conversion: ${calculateFullFunnelRate(customersWon, mqlsGenerated)}`);
// Output: Full Funnel Conversion: 2.40%
Enter fullscreen mode Exit fullscreen mode

7. Pipeline Velocity

This is the ultimate throughput metric. It measures how much revenue is flowing through your pipeline per day. It combines several of the metrics we've discussed into one powerful number that tells you how healthy and efficient your entire sales engine is.

Why it matters: Increasing your pipeline velocity is the goal. You can do it by increasing the number of opportunities, increasing your win rate, increasing your average deal size, or decreasing your sales cycle length.

How to Calculate It

Pipeline Velocity = (Number of Opportunities x Average Deal Size x Win Rate) / Sales Cycle Length (in days)

/**
 * Calculates the daily pipeline velocity.
 * @param {number} numOpportunities - Total opportunities in the pipeline.
 * @param {number} avgDealSize - The average deal value.
 * @param {number} winRate - The win rate as a decimal (e.g., 0.25 for 25%).
 * @param {number} cycleLengthDays - The average sales cycle length in days.
 * @returns {string} The pipeline velocity in currency per day.
 */
const calculatePipelineVelocity = (numOpportunities, avgDealSize, winRate, cycleLengthDays) => {
  if (cycleLengthDays === 0) {
    return '$0.00 per day';
  }
  const velocity = (numOpportunities * avgDealSize * winRate) / cycleLengthDays;
  return `$${velocity.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} per day`;
};

// Example with our previous data:
const velocity = calculatePipelineVelocity(50, 30000, 0.24, 62);
console.log(`Pipeline Velocity: ${velocity}`);
// Output: Pipeline Velocity: $5,806.45 per day
Enter fullscreen mode Exit fullscreen mode

Stop Guessing, Start Instrumenting

Your sales funnel isn't magic; it's a system. And like any system, it can be measured, optimized, and scaled. By tracking these seven metrics, you move from guesswork to a data-driven approach to revenue.

Pick one or two of these to start. Build a simple dashboard or even just a script that pulls data from your CRM. The goal is to gain visibility. Once you can see what's happening, you can start making changes and building a truly predictable growth engine.

Originally published at https://getmichaelai.com/blog/7-b2b-sales-funnel-metrics-you-need-to-track-for-predictable

Top comments (0)