Calculate with IF statement error: Dependency cycles amongst the xpath expressions

Hi ODK Community,

I am building a syntax, that would register 2 types of education materials. It counts first the number of students, then the number of magazines (Kiik and Komunidade). The materials are distributed in grade 1 and 2, in classes from A to D. At the end of each grade group, it would give a summary on the number of students and magazines. Finally, at the end of the survey it would give a final summary on the total magazines distributed in grade 1 and 2. Since there is no class from A to D in every single school, I use the IF calculation, but somehow does no want to work out and get this message while uploading to ONA: Dependency cycles amongst the xpath expressions in relevant/calculate Result: Invalid.

I attached a sample file.
A hint would be much appreciated. Thank you!

test_aluno_insert_12019.xlsx (29.2 KB)