How to get Average or sum of a column

So I was solving this assignment and stuck with the step to get the average of the subjects.
I have merged the 3 sheets into one. But I am not able to understand how to get the average of the columns (subjects). Even I tried with Modified Java Script Value but it gives me data for each row, how can I sum the value of a column and get that in a variable. Is there any way to run a loop.
Combined data:


Update:
I am able to get the average now by using ‘group by’. But How to achieve the same using Modified Java Script Value Step.

Hello Prashant,

Welcome to AutomationEdge Community!!

As per your explanation, you have already reached to the answer.

You explained that, Modified Java Script Value Step gives data for each row. Because Process studio exceutes the input data Row-wise.

In your case you can easily calculate sum of all subjects, as they all are in one row. But for column, either you have to use group by or formula step also help you by pre-performing some Row Normaliser and de-normaliser steps.

I was facing kind of a same problem. But In my case, I was performing sum and average by using calculator. And the problem occurring is Total is being performed correctly but average is not being performed correctly.
What would be the changes I will have to do in calculator?
Please go through the attachment.

hello prashant , i wanted to know how did you calculate average in modified javascript for values in different rows.