Custom Subtotal over attribute elements

Hello there! Today let's talk about creating subtotal over attribute elements. Let's suppose I have 2 attributes and 1 metric in a report template: Year (in columns) , Category (in rows) and Profit(in columns). Let's say that I need to calculate the growth of Profit among 2011 and 2012 for each category. How can I …