Business Context
DRW's quantitative analytics team compares Company A's quarterly profitability in EUR, although source profit records are stored in USD. Exchange rates vary by date, so each profit record must be converted before aggregation.
Task
Write a PostgreSQL query that calculates the percentage increase in Company A's EUR-denominated profit from the first to the last month of Q1 2025.
Requirements
- Join companies, profit records, and daily FX rates.
- Convert each USD profit using
profit_usd * eur_per_usd, then aggregate by month.
- Ignore records with missing profit or FX values and exclude dates outside Q1 2025.
- Return the first month, last month, EUR profit for each, and the percentage increase rounded to two decimals.