Counting numerical and select many responses outside a repeat group.

I am new to KoboToolBox. I am seeking support on a school safety survey project.

At a school site, I want the enumerator first to enter the number of buildings on the site. Then I want him/her to answer a set of questions and take photos related to the questions.

Some of the questions in the repeat group are “numerical” (e.g. the number of classrooms in that building), some are “select many” (e.g. uses: classroom, teachers room, dormitory. storage, etc>), some are “single select” (e.g. condition of the building: poor, fair, bad, etc.).

Outside the repeat group I want to calculate the total number of classrooms, rate the safety of the school based on the condition of the buildings, etc.

How can I conduct these calculations OUTSIDE the repeat group? Please guide me to a reference or give me an example.

Thank you in advance for your support.