You are given customer feedback submitted across DISH touchpoints such as the MyDISH app, chat, phone, and web. Write a PostgreSQL query that returns feedback performance by channel, product_name, and region_name for feedback submitted in Q1 2024. For each combination, show the total number of feedback records, average rating rounded to 2 decimals, counts of positive and negative feedback based on rating, and rank the combinations within each channel by lowest average rating so the most problematic segments appear first. Only include groups with at least 2 feedback records.
Output details
- Return columns in this order:
channel, product_name, region_name, feedback_count, avg_rating, positive_count, negative_count, issue_rank.
- Treat ratings
>= 4 as positive and ratings <= 2 as negative.
- Use an inclusive lower bound of
2024-01-01 and an exclusive upper bound of 2024-04-01.
- Treat NULL ratings as counted feedback, excluded from the average, and neither positive nor negative.
- Rank within each channel by
avg_rating ascending, then feedback_count descending, product_name ascending, and region_name ascending.
- Sort final rows by
channel ascending, issue_rank ascending, product_name ascending, and region_name ascending.