Retail and e-commerce metrics: formulas and SQL

Metrics for orders, returns, inventory and repeat purchase. Returns, guest checkouts and product variants are the three things that most often distort them.