the requirement sounds pretty wild and I don't think you can do that in chart expressions (at least not easily). What you need basically is an hourly total for every time/product combination. I would precalculate that in script in a following way:
1) Create a table with distinct Time/Product combinations:
Tmp_Intervals: LOAD Distinct Product, Time From Fact_Table;
2) Join 1 hour intervals to those combinations
Left Join(Tmp_Intervals) IntervalMatch(Time, Product) LOAD Distinct Time-(1/24) as StartTime, Time as StopTime, Product From Fact_Table;
3) Join respective quantities to those intervals:
Left Join(Tmp_Intervals) LOAD Time, Product, Quantity From Fact_Table;
4) Sum up quantities per interval
Tmp_Interval_Quantities: LOAD Product, StartTime, StopTime, Sum(Quantity) as HourlyQuantity From Fact_Table Group By Product, StartTime, StopTime ;
5) Merge this back to the fact table (perhaps using mapping load and applymap based on Product, Time and Time-(1/24))
6) In your chart you could then use HourlyQuantity field for your purpose.
Hope this helps.