I dont know about your "indexing" question, but i will suggest an alternative way of solving your initial problem:
I have an input table with these columns:
Product_id, Year, Quarter, Turnover
and this table can be denormalized into this table
Product_id, Year, Turnover_Q1, Turnover_Q2, Turnover_Q3, Turnover_Q4
by this sql:
select Product_id,
Year,
sum(case when quarter=1
then turnover
end) as Turnover_Q1,
sum(case when quarter=2
then turnover
end) as Turnover_Q2,
sum(case when quarter=3
then turnover
end) as Turnover_Q3,
sum(case when quarter=4
then turnover
end) as Turnover_Q4
group by Product_id, Year
a clustering index on (product_id,year) on the source table MIGHT improve performance, since it will make sorting during the group-by less I/O-bound.
It works, and CAN be made to perform, but I would recommend putting any where-clauses before the group by (not on the outside of a wiew)
yours Lars