In pivot tables, the total line is always calculated by applying your expression to the current data set. In other words, it completely ignores your dimensions. It does not do a sum of rows. That doesn't matter for some simple expressions like sum(Sales). But it can matter for other expressions.
To get a sum of rows in a pivot table, replace your current expression with this:
I don't know if this is the actual problem, but it's my only guess at this point.