Calculate relative contribution to percent change

Let me use a simple example to illustrate my problem. First, assume we are calculating rate r at time t such that rt = xt / yt. Furthermore, each measure has two component parts: X = xa + xb and Y = ya + yb. We can thus calculate percent change c for the rate between t2 > t1 as c = (r2 - r1) / r1.

Next, I want to allocate c to measure the relative contribution of each component A and B. When the changes are in the same direction between t1 and t2 this is easy (e.g. Xa1 > Xa2 and Xb1 > Xb2 and Ya1 > Ya2 and Yb1 > Yb2). You calculate the change for each component, divide that by the absolute change and apply that "share" to the total percent change. That allows me to make a statement, e.g. when the rate changed from 10% to 15%, 75% of the 50% change was due to component A and 25% to component B.

Here's my question - how can I calculate the relative contribution of these components when the differences are in opposite directions? For example, component A decreased for X and Y (and more for Y, relatively) and component B increased for X and Y (and more for Y, relatively).

I'm sure this is simple but no amount of searching has made me the wiser. If you could point me in the right direction -- or ask questions to better illuminate my subject matter -- I would greatly appreciate your help. Thanks!

PS - I found a few resources, linked below but still aren't sure of the exact math required... http://www.bea.gov/papers/pdf/Moulton0603.pdf http://www.esri.cao.go.jp/en/sna/sokuhou/kako/2007/qe074/kiyoe.pdf

-