I first split all the product, market and type then used a combination of cross tab and append to get the data for each of the letters A,B,C,D. And then joined them using union. King of basic solution but I love looking at better solutions to learn from them.