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