How to Show the Average(Average List of Numbers A, Average List of Number Bs)

I created project planning app. There are multiple types of tasks, we know it could Average progress at the aggregate. But What I need is at the case of 4 Types of project tables. While Type A is the Main Projects and Type B Type C are sub Types, I need to average the Average of type B Tasks progress and type B Task progress and show it on Type A Tasks detail. How can I do that?