Whenever you create a calculated field that is aggregated (i.e. count, sum, countd) Tableau adds AGG around that pill name just so you know its already aggregated. In regards to your question in particular can you share you workbook or see if you can replicate it using the Superstore data so we can troubleshoot?
Thanks for your reply Khang.
Unfortunately I'm unable to recreate this now. But what I notice is that when I add an aggregated field to the view, AGG() is added. If i then try to edit this measure pill, it's as if it's locked in aggregate mode, because normal measures like COUNT([measure]) return an error in that pill, but not in others. I think this is very inconsistent by Tableau.
That still doesn't explain how I got different numbers though.