One line, one deep idea: a ratio does not aggregate like a sum. The exercise ships with PortfolioGrowthPct averaging the six position growth-rates (11.81 %). The fix rebuilds it from the totals (7.74 %).

The one correct line

double PortfolioGrowthPct() =>
    (Total("2025") - Total("2024")) / Total("2024") * 100;

= (1142 − 1060) / 1060 × 100 = 82 / 1060 × 100 = 7.74 %.

Why the average is wrong

positions.Average(GrowthPct) treats every position as if it carried the same weight. It does not:

Position 2024 2025 Growth %
Cash 50 60 20.00
Bonds 400 410 2.50
Equities 300 340 13.33
RealEstate 200 210 5.00
Alternatives 100 110 10.00
Receivables 10 12 20.00

The plain average of that last column is 11.81 % — but tiny Cash (50) and tinier Receivables (10) each grew 20 %, while Bonds — 400 of the 1060 base — grew only 2.5 %. The average gives Receivables the same vote as Bonds, so it wildly overstates the portfolio. The total-based ratio weights each position by its actual size, and lands at 7.74 %.

The rule to carry forward: additive measures (amounts, deltas) sum along a dimension; ratios must be recomputed from the aggregated totals, never averaged from the parts. The deltas in this exercise stayed green precisely because Δ is additive — Σ Delta = 82 = Total25 − Total24.

Live and green

Fix PortfolioGrowthPct to compute growth from the year totals — (Total 2025 − Total 2024) / Total 2024 — instead of averaging the six position growth rates, so the battery lands green on 7.74 %.

The takeaway: the cube stores facts; how you fold them into a number depends on what the number means. Amounts add. Ratios re-divide. Confusing the two is the fastest way to ship a lying dashboard.


← Back to the exercise · Lesson 1 · All solutions

Reconnecting…
The connection to the server was interrupted. Trying to restore it…
Trying again…
The connection could not be restored. Reloading the page…
The server was updated. Reloading the page to pick up the latest version.