Hi Daria,
In addition to what Sunil has mentioned , i think you don't need to get into the AFVC table unless you are using network activities under the WBS. Even then I don't see a need for AFVC as your budgeting is at the WBS level.
And your requirement is to capture Budget, Actual Cost and Remaining Budget and Return as per your formula.. here You should be looking at the below tables:
1. PROJ : For Getting the list of Project.
2. PRPS : for getting the WBS for the Projects..
3. COEP or COSP OR RPSCO.
Though you can get all your values in RPSCO but this is a huge table and you can hit some performance issues.. So you can use COEP or COSP ( if you want to use Line items or totals)..
Rest you can go with the logic given by Sunil.. Just filter the values by the Value type for each project and you should get your desired result..
Regards
Sammar