I did a bunch of testing this past summer on this very issue and I can't figure out a way to do it using Tableau's built-in hierarchies. Fundamentally, the problem is that table calcs and hierarchies don't know anything about each other. This shows up in at least three ways in Tableau:
1) We need to change the offsets/window for the calculations as the hierarchy changes, however we don't have an easy way to figure out what hierarchy level is currently active. I figured out how to do this using a self-blend for each level of the the hierarchy, however...
2) When we expand a hierarchy, the dimension added by the hierarchy is automatically added to the partitioning of all table calculations in the view. This is diametrically opposed to what we want, which would be to add that dimension to addressing (along with changing the offsets/window).
3) If we set a table calculation to address on dimensions that are in the view that are removed (for example by collapsing a hierarchy), the table calculation will fail. In some cases we could get away with relative addressing such as Table (Across), etc. but that will not work for all views. Nested table calculations with custom addressing inside IF/THEN/ELSE statements won't work here either, as soon as we bring the calc into a view Tableau will be looking to see whether all the dimensions used by the nested calcs are in the view.
The workaround that I know of is to avoid Tableau's hierarchies entirely and use a parameter to either swap worksheets or use the parameter to swap out a dimension(s) as well as change the offsets.