Summarise data by a criteria which is in another matrix

Generic selectors
Exact matches only
Search title only
Search in content
Search in all posts
Search in pages
Solved1.32K viewsFormulas and FunctionsAverage select Summary

In the attached simple model, I have a table named Marks which contains marks by student by course. In another table named Demographics, I have the students names and gender. I want to populate a third table, named Marks by Gender, based on the average marks by gender for each course. How can I do that ?
Many thanks in advance

Answered question