Paid revenue per customer
Your task
Given orders with columns order_id, customer, amount, status and placed, sum amount per customer counting only rows whose status is paid. Return customer and total, sorted by customer ascending. Customers with no paid orders do not appear.
Examples
paid_per_customer(orders: dataframe) -> dataframeExample 1
Input
paid_per_customer(orders)orders
| order_id | customer | amount | status | placed |
|---|---|---|---|---|
| 1 | ada | 120.5 | paid | 2024-01-05 |
| 2 | bo | 80 | refunded | 2024-01-07 |
| 3 | ada | 45.25 | paid | 2024-02-11 |
| 4 | cy | 200 | paid | 2024-02-14 |
| 5 | bo | 15.75 | pending | 2024-03-02 |
| 6 | ada | 60 | paid | 2024-03-19 |
Output
| customer | total |
|---|---|
| ada | 225.75 |
| cy | 200 |