Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” The Analytics Engine

โญโญ intermediateโณ 25 min read๐Ÿ“ Lesson 112 of 265

Combine grouping, joining, and aggregation into one report with honest single-pass semantics.

The gate (mini-build)

A tiny sales analytics engine over in-memory rows:

  1. Revenue(IEnumerable<Sale> sales) โ†’ total revenue (decimal).
  2. BestCategory(IEnumerable<Sale> sales) โ†’ category name with the highest revenue (ties: earliest alphabetically).
  3. CustomerMatrix(IEnumerable<Sale> sales, IEnumerable<string> customers) โ†’ per-customer totals in the ORDER GIVEN (zero for customers with no sales), formatted "name=total".
  4. Run(IEnumerable<Sale> sales, IEnumerable<string> customers) โ†’ a report string combining all three, computed from ONE enumeration of sales (graded with a counting source โ€” a second pull fails).

Sale record: (string Customer, string Category, decimal Amount).