I have a table of the weights of stocks in my portfolio for various periods and another with the returns that those stocks had for the same periods.
If I sum the product between the weights and the returns and compound the returns for each period, I will end up with my portfolio return for all periods.
I want to calculate the contribution of each individual stock for my portfolio return across all periods, in a manner that the result will sum to my total return.
Can you help me with this calculation?