Custom aggregation depending on collapsed hierarchy

I have a table with multiple row headers. While not formally a hierarchy, they do act like one when collapsed and expanded.

I’d like the aggregation to be different depending on which level is expanded / collapsed.

For example:
If I have a sales measure for each salesperson, and each salesperson has a team, and each team has a location. I’d like to:

  1. Show an individual’s sales when both levels are expanded
  2. Show the average sales when the team level is collapsed
  3. Show the sum of #2 when the location level is collapsed

(This is a made-up example, don’t overanalyze it haha)

I’ve looked at a few options, like Totals Calculation Rules but it doesn’t seem to be what I’m looking for. Or is it?