Excellent choice! Let's walk through this together. First, let me answer your question about output type, then we'll go through each step.
Why PDF is perfect for this report:
Alternative: Excel if you want recipients to manipulate data (but for a summary/overview, PDF is cleaner).
Let's start by creating the report configuration:
Sales by Customer SummaryYou should now see a new report folder under Configuration → Reports. Let me know when you've done this, and we'll move to Step 2!
While you're doing Step 1, here's what our SQL query will look like (joining Customers, Orders, and Order Details):
SELECT
c.CustomerID,
c.CompanyName,
c.ContactName,
c.Country,
c.City,
COUNT(DISTINCT o.OrderID) as TotalOrders,
SUM(od.Quantity * od.UnitPrice * (1 - od.Discount)) as TotalRevenue,
SUM(od.Quantity * od.UnitPrice * (1 - od.Discount)) / COUNT(DISTINCT o.OrderID) as AvgOrderValue,
SUM(o.Freight) as TotalFreight,
MIN(o.OrderDate) as FirstOrderDate,
MAX(o.OrderDate) as LastOrderDate
FROM Customers c
LEFT JOIN Orders o ON c.CustomerID = o.CustomerID
LEFT JOIN "Order Details" od ON o.OrderID = od.OrderID
GROUP BY c.CustomerID
ORDER BY TotalRevenue DESC
This gives us one row per customer with all the metrics we need.