Try to do the aggregate directly with the name of the dynamic group.
aggr(SUM([Sales]), NameOfYourDynamicGroup)
I've tried something recently with a hierarchical group.
In QV9, it will show you this is a bad field name, but you don't have to worry, they don't recognize it as a variable, but it doesn't mean this is not correct.