Customer Spending Over the Last 30 Days

Customer Spending Over the Last 30 Days

At MTS, a product analyst compiles a weekly ranking of customers by spending over the past month for triggered marketing campaigns and upsell offers. Today is 2026-05-05. Calculate each customer's total spending over the last 30 calendar days, including today: from 2026-04-06 through 2026-05-05, inclusive. Ignore the time of day: include transactions made at any hour on those dates. Specify the dates explicitly in the query because CURRENT_DATE returns the real current date in the sandbox. Exclude customers with no transactions in this window. Sort the result by total spending in descending order.

Row order matters

Expected output columns:client_idspend_30d

Showing the first 3 rows of the sample — the full sample comes with Premium

MTS
Similar tasks

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid