When does it make sense to aggregate data before a JOIN?

A report joins customers, orders, and order items, then calculates metrics for each customer. Explain when aggregating before the JOIN would be more efficient. When could this rewrite produce incorrect results, and what should you check before changing the query?

ExplainEXPLAIN and optimizationMiddleAnalystData EngineerBackend