Skip to content

Research / Reporting correctness

How group size changes an overall completion KPI.

A deterministic arithmetic investigation using synthetic populations. No client data, timing benchmark or peer-review claim.

By Datta Sable · Published · Version 1

Abstract and question

What happens when an overall completion metric is calculated by averaging team percentages? If teams have different sizes, averaging their percentages gives each team equal weight rather than giving each eligible record equal weight. In executive reporting, this distinction is not a cosmetic rounding nuance: it changes the reported KPI by tens of percentage points and can reverse directional trends between periods.

This investigation isolates the exact arithmetic difference between the unweighted mean of group rates and the denominator-weighted aggregate ratio, demonstrates why both formulas are mathematically valid answers to different questions, and provides production-ready SQL, Power BI DAX, and Python patterns to prevent silent metric drift in enterprise scorecards.

Environment, dataset and assumptions

The reference implementation in lib/weighted-kpi.ts uses JavaScript Number arithmetic and validates safe integer counts. Each denominator is strictly positive; completed counts are nonnegative and cannot exceed the denominator. Groups are assumed disjoint and their completion definitions identical.

Complete synthetic input dataset (two-team minimal counterexample)
GroupCompletedEligibleGroup rateShare of population
Team A91090.00%9.09%
Team B1010010.00%90.91%

Methodology and experiment

  1. Divide each completed count by its eligible count to obtain individual group rates.
  2. Calculate the arithmetic mean of these group rates (equal weight per group).
  3. Independently divide the sum of completions by the sum of eligible counts (equal weight per eligible record).
  4. Compare the unrounded values; round only the displayed percentages at the presentation layer.
overall_weighted_rate = sum(completed) / sum(eligible)
mean_group_rate       = sum(completed / eligible) / group_count

Notice that the overall weighted rate is algebraically identical to a weighted average of group rates where each group's weight is its share of the total eligible denominator (eligible_i / sum(eligible)). When denominators are equal, both formulas collapse to the same number. When denominators vary, the unweighted mean systematically amplifies smaller groups and suppresses larger ones.

Results and interpretation

On the two-team fixture, the mean group rate is 50.00%, whereas the overall weighted rate is 17.27% (19 / 110). The 32.73 percentage-point gap occurs because Team B accounts for 90.91% of all eligible records (100 of 110) yet receives only 50.00% of the vote in an unweighted mean.

Equal group sizes make the calculations equal. Equal group rates also make them equal. In general, unequal denominators produce different results; the reporting question determines which metric to use:

  • Portfolio / record-level question: “What fraction of all eligible records completed?” — requires the denominator-weighted overall ratio (17.27%).
  • Unit / manager-level question: “What is the average completion rate across our operating teams, treating each team as an equal unit?” — requires the unweighted group mean (50.00%).

Worked executive scorecard example: multi-branch SLA reporting

In real MIS and operations dashboards, the two-team distortion scales across regional hierarchies. Consider a synthetic five-unit fulfillment network where two small pilot branches handle 35 combined orders at over 93% SLA compliance, while three mature hubs handle 1,165 orders with lower compliance.

Synthetic five-unit regional scorecard demonstrating pilot-branch bias
Operating unitOn-time ordersTotal ordersUnit SLA %
North Metro Hub42050084.00%
West Industrial Zone31045068.89%
Pilot Branch A192095.00%
Pilot Branch B141593.33%
South Rural Cluster9521544.19%

If a spreadsheet summary or Power BI visual takes the simple average of the five unit percentages, the executive headline reads 77.08%. Yet across all 1,200 orders shipped, only 858 arrived on time—an actual customer-experienced SLA of 71.50%. Two pilot branches representing less than 3% of order volume pulled the reported headline up by 5.58 percentage points.

Production fixes in SQL, Power BI DAX, and Python

The most common engineering cause of unweighted KPI drift is storing a pre-computed percentage column (such as completion_pct) in an ETL summary table and then applying AVG(completion_pct) in a BI layer. Once the numerator and denominator are discarded, downstream slice-and-dice filters cannot recover the true weighted ratio. Always persist raw additive counts at the reporting grain and compute ratios at query time.

1. SQL (PostgreSQL / T-SQL / Fabric Warehouse)

-- Store raw numerators and denominators in the fact or aggregate table.
-- Compute the weighted ratio at query time with zero-denominator protection.
SELECT
  region_name,
  SUM(completed_count) AS total_completed,
  SUM(eligible_count)  AS total_eligible,
  CAST(SUM(completed_count) AS DECIMAL(18, 6))
    / NULLIF(SUM(eligible_count), 0) AS weighted_completion_rate,
  AVG(
    CAST(completed_count AS DECIMAL(18, 6))
      / NULLIF(eligible_count, 0)
  ) AS unweighted_unit_mean
FROM mart_unit_daily_kpi
GROUP BY region_name;

2. Power BI DAX (Semantic Model Measures)

-- Weighted portfolio KPI (default for executive scorecards)
Completion Rate % :=
DIVIDE(
    SUM( FactUnitKpi[CompletedCount] ),
    SUM( FactUnitKpi[EligibleCount] )
)

-- Unweighted unit mean (only when explicitly requested for equal-unit benchmarking)
Mean Unit Completion % :=
AVERAGEX(
    VALUES( DimUnit[UnitKey] ),
    [Completion Rate %]
)

Notice how Power BI's implicit column aggregation (dragging a pre-calculated percentage column onto a card and setting summarization to “Average”) silently produces the unweighted mean. Defining explicit DIVIDE(SUM(...), SUM(...)) measures in the semantic model guarantees that every slicer, drill-down, and matrix subtotal recomputes the true weighted ratio. See the DAX evaluation context guide and Power BI modeling standards for related patterns.

3. Python (pandas validation & reporting script)

import pandas as pd

# Group-level rollup preserving additive components
summary = df.groupby("region", as_index=False)[["completed", "eligible"]].sum()
summary["weighted_rate"] = summary["completed"] / summary["eligible"]

# Portfolio totals must sum numerators and denominators independently
portfolio_weighted = df["completed"].sum() / df["eligible"].sum()
portfolio_unweighted = (df["completed"] / df["eligible"]).mean()

Governance rules for executive scorecards

  • Ban non-additive ratios from base fact tables: Treat percentages, averages, and rates as semantic-layer measures rather than stored fact columns whenever slice-and-dice aggregation is expected.
  • Label the unit of analysis explicitly: Name measures “Portfolio SLA % (Order-Weighted)” or “Average Branch SLA % (Equal-Unit Mean)” so readers know whether a 50-order pilot carries the same weight as a 5,000-order hub.
  • Audit subtotal rows in matrix visuals: If a dashboard table displays individual branch percentages alongside a Total row, verify that the Total row evaluates the ratio of sums rather than the average of visible rows.
  • Guard against fan-out joins before summing counts: Even a correctly written DIVIDE(SUM(...), SUM(...)) measure will fail if an upstream SQL join duplicates rows. Pair this pattern with the SQL join grain study.

Limitations

This example does not estimate population behavior, causal effects, uncertainty, performance or financial impact. It assumes complete, disjoint counts and has no treatment for missing records or zero denominators. Floating-point arithmetic can introduce rounding error in extreme ratios.

Reproduction and evidence

Open the interactive weighted KPI lab and use Reset sample to edit denominators in your browser. In the repository, run node --test tests/mission95.test.mjs. The calculation is in lib/weighted-kpi.ts.

The input tables above are synthetic datasets. No external experimental dataset was used. The automated tests are correctness checks, not independent scientific review.

Related guides & engineering resources

Citation and revision history

Sable, Datta (2026). How group size changes an overall completion KPI. Version 1. https://dattasable.com/research/weighted-kpi-aggregation

6 December 2026: initial method, synthetic inputs, worked scorecard, SQL/DAX/Python patterns, and tests. Report a calculation issue or suggest a correction.