i want to calculate the average over all scores.
{
"single_results": [
{
"name": "Rule1",
"results": [
{
"name": "Sample1",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 6
},
{
"name": "Sample2",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 5
},
{
"name": "Sample3",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 8
},
{
"name": "Sample4",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 9
}
]
},
{
"name": "Rule2",
"results": [
{
"name": "Sample5",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 7
},
{
"name": "Sample6",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 6
},
{
"name": "Sample7",
"positive_comment": "xxx",
"negative_comment": "xxx",
"score": 10
}
]
}
]
}
My code actually calculate the average of each rule and then the average of the average of this rules. Is it possible to calculate the average over all scores?
"Avg: "& Average(
ForAll(
ParseJSON(<JSONstring>).single_results As rec;
{name: Table(rec.result).Value; avgValue:Average(Table(rec.results);ThisRecord.Value.score)}
);avgValue
)