If you use the same variable in a different formula that is accumulating, it would change the value. But since you say you are using a different variable, I'm guessing that you have some suppressed records that are being counted. If you are conditionally suppressing records, then you need to build the suppression criteria into the accumulation formula, as in:
whileprintingrecords;
numbervar rt;
if {table.field} <> "x" then
rt := rt + 1;
-LB