update balance calculation (store non-zero values only)