Finance Data Analyst Path · Mission 7 of 30Easy

Top 10 vendors — YTD spend

GROUP BY + ORDER BY + LIMIT

Back to Finance Data Analyst

The Brief

Daniel OkaforControlleraccounting

AP renewal season. I need the top 10 vendors by 2025 YTD spend — show `vendor_name` and `total_spend`, sorted highest to lowest, limit 10. Only posted entries. Include all account types.

You'll practice

GROUP BYORDER BYLIMIT

Tables & columns available

fact_transactionsfact10 columns
ColumnTypeKey
txn_idINTPK
txn_dateTEXT
account_idINTFK → dim_accounts
cost_center_idINTFK → dim_cost_centers
vendor_idINTFK → dim_vendors
amountREAL
currencyTEXT
descriptionTEXT
postedINT
posted_dateTEXT
dim_vendorsdim5 columns
ColumnTypeKey
vendor_idINTPK
vendor_nameTEXT
categoryTEXT
countryTEXT
onboarded_dateTEXT

Hints (3)

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

Hint 1

Vendor names and transaction amounts are in separate tables. Before you rank, think about which transactions should be included — not all entries in the ledger are finalized.

Hint 2

GROUP BY vendor_name (or vendor_id), SUM(amount) AS total_spend, ORDER BY total_spend DESC, LIMIT 10.

Hint 3

Remember the trailing-space Stripe — if your LOWER(TRIM(...)) collapsed them, that's fine; if not, you'll see both. Either output is acceptable.