Write a SQL query to calculate weekly inventory turnover by store at Walmart and rank stores by turnover within each region.
Use the provided store, inventory snapshot, and sales transaction data for the week beginning January 6, 2025. Include active stores with inventory records for the week, including stores with no qualifying sales.
Output
- One row per active store and week
- Columns:
week_start, region, store_id, store_name, cogs, avg_inventory_value, turnover, and regional_rank
- Turnover is cost of goods sold divided by average inventory value
- Sort by
region, regional_rank, then store_id