I have a question: Is it possible to modify the Set Analysis in a way that when a specific value occurs in a hierarchy, all other values become zero? For example, if the child A2 appears in the hierarchy, then A, A1 must be 0, and B, B1 must also be null. C keeps the same.
If you could get the intended results by selecting the wanted values in the various fields you should be able to apply it also in the set analysis. This means your data-structure must support it by providing the needed associations.
If I understood your descriptions right - which doesn't fit to the shown example - you may play with something like;