Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Multiple metrics for a single object
Metrics for two groups
5. Custom metrics – exercise
Ratios and percentages
Global vs. specific metrics
Summary

Instruction

Perfect! One more exercise before we move on.

Exercise

For each order, determine how many line items (unique products) were discounted and how many weren't. Show three columns:

  • The order ID (OrderID).
  • The number of line items that weren't discounted (as FullPriceProductCount).
  • The number of line items that were discounted (as DiscountProductCount)

Stuck? Here's a hint!

You can use the following to calculate the number of full-price products in each order:

COUNT(CASE
  WHEN Discount = 0
    THEN ProductID
END)