Grain first, window secondConcept

Concept

Running totals done right

Decide what one row means (a month), aggregate to that grain in a CTE, then apply the window: SUM(revenue) OVER (ORDER BY month). Skip the CTE and the running total steps up on every transaction row. The capstone: North Star, functional, and granular in one query, one definition each.

0/5 answered · Enter to check