← Back to WorkSQL · SALES ANALYSIS · RECONCILIATION

Five questions.
Traceable answers.

A reproducible SQL investigation into why stronger sales do not always produce equally strong profit. The same source records power the Excel dashboard.

Independent portfolio work · 576 fictional monthly records · complete 2024–2025 sample · USD.

THE QUESTION

Where does sales growth turn into profit, and where does it fall short?

THE APPROACH

Five readable queries, matching-year comparisons, integer-cent source amounts, and independent reconciliation checks.

TRY IT

Download the source CSV, SQLite schema, queries, Python runner and result tables. No database server or paid tools required.

KEY FINDINGS

What the evidence tells us.

Full-year 2025 vs 2024 · 576 fictional monthly records. Download the linked results to inspect the exact figures.

$783K + $144K

More orders explain most revenue growth

The order-count contribution is $782,979.78; revenue per order contributes $144,138.98. Together they reconcile to $927,118.76 of growth.

Decision to inform

Separate order volume from revenue per order; the latter combines price, discounts, basket size and mix.

Revenue driver results
Furniture: −4.0 pp

Category pressure is concentrated

Furniture margin falls about 4.0 percentage points to 19.7%, the largest category decline. Other category margins change only slightly.

Decision to inform

Prioritize a Furniture cost, discount and mix review. Within-category effects exclude shifts in category revenue mix.

Category margin results
$313K below plan

Start the regional review in West

West reaches 88.3% of its annual revenue plan, a $312,710.96 shortfall—the largest regional gap in the sample.

Decision to inform

Check West’s plan assumptions and segment performance before choosing an intervention.

Regional plan results
FINDINGS FROM THE FICTIONAL 2025 SAMPLE

Follow the evidence.

Each answer links to the exact query and its downloadable results. Growth comparisons use the same full-year scope.

Aggregation · LAG · safe division

Is growth reaching profit?

12.7% → 7.9%

Revenue grew 12.7%, but gross profit grew 7.9%. Start by separating business growth from profitability.

CTEs · two-part decomposition

What drove revenue growth?

$783K + $144K

Higher order count contributes about $783K and higher revenue per order contributes $144K to the $927K revenue increase.

Matching periods · reconciled contributions

What held profit back?

+$302K − $115K

Revenue growth adds about $302K to gross profit. Margin pressure offsets $115K, leaving a $187K increase.

PARTITION BY · weighted margins

Where did margins weaken?

Furniture: −4.0 pp

Furniture margin falls to 19.7%, the largest category decline. Category mix still matters: within-category effects are not the same as the aggregate margin effect.

Grouped comparison · RANK

Where should the review start?

West: $313K below plan

West has the largest revenue shortfall. Review assumptions, discounts, costs and product mix before assigning a business cause.

REPRODUCIBLE AND REVIEWABLE

Show the work.
Check the answer.

One source, two tools

The CSV is exported from the reviewed Excel source table. The SQL totals match its $8,242,432.31 revenue and $2,573,848.19 gross profit for 2025.

Checks that can fail

Validation covers the full monthly grain, duplicate rejection, impossible discounts, independent totals, missing prior-year handling and both driver reconciliations.

Limits stay visible

No customer or transaction-level conclusions are supported by these monthly records. The contributions explain arithmetic, not causality. 2024 comparisons stay unavailable because 2023 is absent.

APPLY THIS TO YOUR TEAM

Need to explain a change in performance?

Discuss a SQL investigation with agreed measures, traceable calculations and a concise findings readout.