PayPal's risk team scores every payment from 0 to 1. They want to check that the score means something: do high-risk payments really end badly more often?
Put each transaction in a risk band: 'low' (score under 0.3), 'medium' (0.3 to under 0.6) and 'high' (0.6 or more). For each band, show the number of completed, refunded and failed transactions, and the share that did not complete.
Expected output
bad_outcome_pct = (refunded + failed) as a percentage of the band, rounded to 1 decimal; any row orderExample of the shape (made-up values):
| risk_band | completed | refunded | failed | bad_outcome_pct |
|---|---|---|---|---|
| medium | 400 | 30 | 18 | 10.7 |
Hints, the later steps and the answer come with Pro.
Write your query here. Ctrl + Enter submits.