As per my understanding , the variable concept will not work. Because variable can store only single value.
Hence when you write an expression inside variable, it summarize the value and stores in it. Hence when you are selecting the certain values , it again summarize the data and store inside that.
eg: Variable1 = Sum(Amt) . Variable1= 50
if variable used inside pivot table
And when you select A . It will store A= 10
I hope you are clear with the issue.
If you can attach some sample, we can try out other alternative methods.