Answer:
with MonthlyRevenue as
(select s.SupplierID,
od.ProductID,
DATE_TRUNC('month', o.OrderDate) as MonthStart,
SUM(od.Quantity * od.UnitPrice * c.ExchangeRateToBase) as RevenueBase
from Orders o
join OrderDetails od on o.OrderID = od.OrderID
join Currency c on od.CurrencyID = c.CurrencyID
join Products p on od.ProductID = p.ProductID
join Suppliers s on p.SupplierID = s.SupplierID
where o.Status = 'Completed'
group by s.SupplierID,
od.ProductID,
DATE_TRUNC('month', o.OrderDate))
select SupplierID,
ProductID,
MonthStart,
SUM(RevenueBase) over (partition by SupplierID,
ProductID
order by MonthStart rows between 2 PRECEDING and current row) as RollingRevenueBase
from MonthlyRevenue
order by SupplierID,
ProductID,
MonthStart;