Excellent detective work! You found it — the Report Generation capability needs to be enabled first. That's a great learning moment!
In the ReportBurster top menu, go to:
Now configure the SQL query:
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