Write a PostgreSQL query that compares June 2024 cardmember performance across region and segment. Your result should show active cardmembers, total billed amount, average billed amount per active cardmember, and a label indicating whether each group is above or below the overall portfolio average. Only keep groups with at least 2 active cardmembers.
| Column | Type | Description |
|---|---|---|
| customer_id | ||
| customer_name | ||
| region | ||
| segment | ||
| signup_date |
| Column | Type | Description |
|---|---|---|
| transaction_id | ||
| customer_id | ||
| transaction_date | ||
| billed_amount | ||
| merchant_category |