Procurement & Sourcing Analytics · Mission 13 of 30Medium

Preferred vs non-preferred share

GROUP BY a flag, with SUM

The Brief

Maya ChenProcurement Directorprocurement-ops

Split spend between preferred and non-preferred suppliers. Show is_preferred (0/1) and total_spend.

You'll practice

GROUP BY

Tables & columns available

fact_invoicesfact7 columns
ColumnTypeKey
invoice_idINTPK
po_idINTFK → fact_purchase_orders
supplier_idINTFK → dim_suppliers
invoice_dateTEXT
invoice_amountREAL
po_amountREAL
payment_dateTEXT
dim_suppliersdim8 columns
ColumnTypeKey
supplier_idINTPK
supplier_nameTEXT
countryTEXT
tierINT
category_focusTEXT
diversity_certifiedINT
payment_terms_daysINT
is_preferredINT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

JOIN invoices to suppliers.

Hint 2

GROUP BY is_preferred.

Hint 3

SUM(invoice_amount).