Interactive demo
A revenue-ranked report answers who is big. It cannot answer who is profitable, who is growing, or who is quietly leaving, because those live in the joint distribution of several behaviors. This demo runs k-means on a synthetic book of accounts for a national construction-supplies distributor and shows a segment that ranking by revenue structurally cannot surface: high-margin, fast-growing customers sitting in the middle of the revenue list.
Prefer the written version? Read the full analysis on the blog.
Loading the demo data...
The accounts are generated by a seeded numpy script, engineered so three economically opposite groups overlap in revenue. That script also runs k-means (implemented by hand, no scikit-learn) and picks the number of segments by the elbow of inertia plus the Davies-Bouldin index. The clustered result is exported to a static JSON that this page fetches and renders with a small set of hand-rolled, dependency-free SVG charts, so the whole thing is a static export with no server. In a real deployment the model runs upstream (a scheduled job or the warehouse), not in the browser. Everything here is synthetic and models no real company or customer.
View the raw data that drives this page.
If your dashboards rank by revenue and you suspect the real story is in the margins, that is exactly the kind of problem I like to take end to end.