use AdventureWorksDW
go

-- Do this if not already done to produce a bigger FactInternetSales
-- This makes it three times bigger
/*   
select * into FactInternetSalesNew
from FactInternetSales

insert into FactInternetSalesNew
select * from FactInternetSales

insert into FactInternetSalesNew
select * from FactInternetSales

insert into FactInternetSalesNew
select * from FactInternetSales
*/

-- Should exist and have over 241000 rows
select count(*) from FactInternetSalesNew

-- multiple bitmap steps
-- in SQL Server 2005, only one bitmap step was allowed per query
select ProductAlternateKey, CalendarYear, SUM(SalesAmount)
from FactInternetSalesNew fact
join DimTime
  on fact.OrderDateKey = TimeKey
join DimProduct
  on DimProduct.ProductKey = fact.ProductKey
where CalendarYear BETWEEN 2003 AND 2004
  and ProductAlternateKey LIKE 'BK%'
group by ProductAlternateKey, CalendarYear
