Finance Data Analyst Path · Mission 9 of 30Easy

Departmental spend by month

Multi-table JOIN with GROUP BY on two dimensions

Back to Finance Data Analyst

The Brief

Mei LinFP&A Managerfpna

Building the 2025 monthly spend trend by department. OpEx only, posted only, all 11 months we have so far. Columns: `department`, `month`, `total_spend`. Sort by department then month.

You'll practice

GROUP BYMulti-JOINDate truncation

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_accountsdim5 columns
ColumnTypeKey
account_idINTPK
account_codeTEXT
account_nameTEXT
account_typeTEXT
is_activeINT
dim_cost_centersdim5 columns
ColumnTypeKey
cost_center_idINTPK
cost_center_codeTEXT
cost_center_nameTEXT
departmentTEXT
owner_emailTEXT

Hints (3)

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

Hint 1

Spending amount, account type, and department name all live in different tables — you'll need to bring them together. Once joined, think about how to group by both department and month simultaneously.

Hint 2

Filter `LOWER(account_type) = 'opex'` — there's no casing trap here since the miscase is on Revenue, but the habit matters.

Hint 3

GROUP BY department, month — use `EXTRACT(MONTH FROM txn_date::date)` for the month number.