Scripts for  Data Creation

SELECT
   Month_Id,
   TO_NUMBER(SUBSTR(month_id,5)) month_Num,
   Sales_Amount,
   SUM(Sales_Amount)
      OVER(PARTITION BY SUBSTR(month_id,1,4)  
      ORDER BY month_id) sales_total
FROM
   Fact_Sales_Summary 
;

Yearlt Running Total Query Output

By use of PARTITION BY SUBSTR(month_id,1,4) in the OVER(...) windowing function, the running total ends at the last valve of the year (201212) and starts at the running total from the begining of the new year (200301).


Cummulative Total Sequential

Running Total   Full table (without PARTITION BY)

Cummulative Total With Null Values

Cummulative Totals

Top



    74009