Calculating average of column
Calculating average of column
Rakoto
Posts: 8Questions: 2Answers: 0
https://jsfiddle.net/lbriquet/k2zr5Lws/1/
Hi everyone,
I want to calculate average values of age based on the city like in the example above. Then I want to show this value on collapsed groups. For example, when we review Sidney, We see two values with an average value of 30. How can I show this value near the text of Sidney just like the total row number?
This question has an accepted answers - jump to answer
Answers
Use
cells().data()
to get the data for the column in question, with the row selector set to be the rows for the group. Then you can usereduce()
to calculate the sum:Updated example.
Allan
@allan Thanks Allan Have a nice day