Project: a customer report without double counting
Combine four tables into one report, retaining customers without purchases. Separate filtering, metrics and zero filling instead of mixing their responsibilities.
Build customer-grain metrics first, then LEFT JOIN them to customers. Paid/date filters belong in the metric stage. Count each order id once; item value uses quantity times its historical unit price.
- Project: a customer report without double counting
- Build customer-grain metrics first, then LEFT JOIN them to customers. Paid/date filters belong in the metric stage. Count each order id once; item value uses quantity times its historical unit price.