ProfitWell's core offering was billing analytics for SaaS companies, and one of our most requested features was to be able to segment a company's SaaS metrics (e.g. MRR, retention rate, growth rate, etc.) by all of the various attributes of a company's customer base (e.g. demographics, signup date, location, lifetime spend, current plan, etc.). This proved challenging given the volume of data we were processing, and the fact that that these metrics needed to be computed in a HTTP request lifecycle, since we couldn't be sure what exact query the customer would run. I designed and implemented a segmentation engine that would (1) automatically and continuously synchronize with our primary, source-of-truth, databases, (2) calculate, on the fly, the most important SaaS metrics given a filter of customer attributes, and (3) scaled it up to handle ProfitWell's largest customers at a reasonable cost (since we were offering the metrics platform for free).