Create Simple Query for Moving Average of Sales
I have a table that has sales entries over time, with fields: customer_number, sales_amount, and process_date.
I want to look at
1) weekly sales amounts
2) and find the weekly moving average
3) and determine if the last 4 weeks of sales have dropped below 20% of the latest moving average
Output will be:
with 1 row for each customer