Write a SQL query using complex aggregations and window functions to analyze product sales by region.