Arby's Marketing Analytics uses store-level sales trends to evaluate campaign performance and promotional lift. A seven-day rolling total helps smooth daily variation while preserving store-level detail.
Write a PostgreSQL query that returns each store's daily sales and its seven-day running sales total. Include dates with recorded sales, aggregate multiple transactions from the same store and date before applying the rolling calculation, and exclude transactions that do not match a known store.
sales_transactions to stores to return the store name.SUM(sale_amount).| Column | Type | Description |
|---|---|---|
| store_idPK | INTEGER | Unique Arby's restaurant identifier |
| store_name | VARCHAR(100) | Restaurant name |
| city | VARCHAR(80) | Restaurant city |
| region | VARCHAR(40) | Operating region |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique transaction identifier |
| store_id | INTEGER | Referenced restaurant identifier |
| sale_date | DATE | Date of the sale |
| sale_amount | NUMERIC(10,2) | Transaction sales amount |
| channel | VARCHAR(20) | Sales channel |