Expression can't seem to calculate decimal grades

Hello Everyone,

I have an issue with the expressions. I want to calculate weighted averages and the expression is working so far. However, every time when I enter a decimal grade, the weighted average becomes a weird number.

E.g.
Grade = 10 Count = 3
Grade = 8 Count = 3
Average is 9. This is working fine.

Grade = 10 Count = 3
Grade = 8 Count = 3
Grade = 7.1 Count = 3
Average is 0.14. This is wrong.

Does someone can help me fix this problem.

Scott

@scott.g

We see the result. How did you get there?

Hard to help otherwise :grimacing:

@cmarchan That true oops…

I first set out to use the Toolbox plugin. In here, there is an element called Expression. I have used the following expression:

Then, to calculate the sumproduct i used the following data (cijfer is grade in Dutch/weging is weight(or count) in Dutch)

When i inspect the expression in the preview mode, everything is working fine:

However, the problem arises when I add a decimal grade (shown in example below):
When I add a 7,5 with a count of 2, the average is calculated correctly… But when I add a 7,3 with a count of 2, this happens:

My question is how to fix this weird issue.

Thanks in advance!

Small addition… It seems that the expression like: 68,6 / 8 is only dividing the 6 by 8… 6/8=0,75.

So the solution lays on how to let the system include the whole number, instead of just the 6 after the decimal.