Revenue share by category

MediumAmazonjoinsctespercent of total· 20 XP

Amazon's retail leadership wants a one-glance view of which product categories bring in the money, based on what customers actually received.

For delivered orders only, find each product category's revenue and its share of total revenue. Revenue for an order line is quantity × unit_price × (1 − discount), where a missing discount means no discount.

Expected output

  • revenue rounded to 2 decimals, pct_of_total as a percentage rounded to 1 decimal; any row order

Example of the shape (made-up values):

category revenue pct_of_total
Electronics 41250.75 27.3
Books 9810.10 6.5

Hints, the later steps and the answer come with Pro.

Write your query here. Ctrl + Enter submits.