This graphic illustrates how to calculate the gain/loss amount from the AA and the XA ledgers.