You are given purchasing and receipt data exported from an ERP such as BAE Systems USA SAP. Write a PostgreSQL query that returns, for each supplier and month in Q1 2024, the total spend, average cost variance versus standard cost, on-time delivery rate, and a performance flag. Only include supplier-month combinations with at least 2 purchase order lines in that month.
The result should help you spot suppliers with worsening price performance or delivery reliability by summarizing purchasing activity at a monthly level.