I do not really understand what you are doing, but ExecuteSQL is a good way to summarize a field without context to the layout table occurrence.
You can do this with relationships which match the data according to the purpose so long as the purposes are not too many.
eg. if you have a global field for each purpose eg one which calculates "25UE" and a self relationship using 25th Affiliation1 and that global field to relate to the same table... that becomes your first column... by placing the related summary field for total Gifts in a summary part when sorted by 25th Affiliation1. You would create the same global calcs for each of "25U4" and "25UR"
I hope this makes sense.
You might also want to check out CCPivot
A fantastic product from Cleveland Consulting designed to make pivot reports easy. Court and Kevin just released version 2 with some updated features.