TICKIT-04: Role-Playing Dates and Seasonality
Track: TICKIT Marketplace • Difficulty: Beginner • Mastery Points: 100 PTS
Business Problem Scenario
TICKIT's commercial executive team needs to analyze monthly marketplace seasonality and month-over-month revenue velocity. Joining sales facts to a generic calendar date without distinguishing between the transaction sale date and the scheduled event date distorts seasonal analysis. By joining to the role-playing dimension gold.dim_date_sale, you must calculate monthly gross revenue and compare it against the prior month using window functions.
Engineering Objective
Write a monthly seasonality trend query joining gold.fact_sales s to role-playing date dimension gold.dim_date_sale d on s.date_sk = d.date_sk. • Expected Columns: d.year, d.month, total_tickets, gross_revenue, prev_month_gross • Metric Calculations: - Group by d.year, d.month. - total_tickets = sum(s.qtysold) - gross_revenue = sum(s.pricepaid) - prev_month_gross = LAG(sum(s.pricepaid), 1) OVER (ORDER BY d.year, d.month) - Order by d.year, d.month. Key Concepts: - Role-Playing Dimension: Reusing a single dimension table under multiple semantic aliases (e.g. sale date vs. event date).
Target Table: gold.fact_sales s, gold.dim_date_sale d (date_sk INT, caldate DATE, month INT, qtr INT, year INT, holiday BOOLEAN)
Verification & Architecture Insights
Disentangling event performance dates from transactional settlement dates reveals actual lead-time purchase behavior and holiday demand elasticity.