From my point of view the best way to solve this is by doing the computation in a parser method that return the list of rows to display and iterate that list in the qweb report template. An example for your image
def crosstab(self, values):
crosstab = []
headers = ('','Col 1', 'Col 2')
crosstab.append(headers)
crosstab.append(('Line 1', 'Value (1,1)', 'Value (1,2)'))
crosstab.append(('Line 2', 'Value (2,1)', 'Value (2,2)'))
#calculate the rest of the lines or the previous to add the result to the list
crosstab.append(('Line 1', 'Value (1,1)', 'Value (1,2)'))
return crosstab
Use like this in the qweb report template:
<table class="table table-bordered">
<t t-foreach="crosstab(value)" t-as="row">
<tr>
<t t-foreach="row" t-as="measure">
<td t-esc="measure"/>
</t>
</tr>
</t>
</table>
Change value to what you need to pass to the report function as an argument or pass more or less arguments depending of what you need to use to compute the crosstab table measures
Here is how to add functions in the parser, config the parser and use it on the qweb report template:
https://www.odoo.com/es_ES/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244
Thanks Axel for your answer. It's very interesting. In my case, the survey module has no Qweb reports, it's based on generated Qweb templates. My goal is to compute the values and store them in the database, so as to use them on the survey dashboard. To be more precise, I'm developping a very specific human ressources appraisals, and the purpose is to compute values based on other fields value to give the hr manager, after the evaluation, an idea about the reaching goals percentage, defined last year. Therefore, once the evaluation is finished, the manager should be able to print these computed values, and also have them on his dashboard. Is it possible to do such developpement using javascript functions ? How could it be stored on the database then ? ( I would like to know more about what happens on server side when the evaluation form is sent). Thanks a lot for your answers.