zreptil / nightscout-reporter

a web app to create PDF documents from nightscout data
https://nightscout-reporter.zreptil.de/
BSD 3-Clause "New" or "Revised" License
59 stars 47 forks source link

Bug?: Daily Statitics - Totals are wrong #35

Closed cfaagaard closed 4 years ago

cfaagaard commented 4 years ago

How are the totals in the Daily Statistics calculated? I have tried make a simple average and weighted average (based on the number of "values") and neither match the numbers in the report. image For example if you look at the CV% in the picture. Total for 3 days is 46,2. A simple average of the numbers: 31.4 A weighted average of the numbers: 35.5

Same thing with SDev. Total for 3 days is 3.0 A simple average of the numbers: 2.1 A weighted average of the numbers: 2.4

quizzmaster commented 4 years ago

These are not averages but the values for the whole period. You simply can't just build an average :wink:

cfaagaard commented 4 years ago

aaaahhhh. Thank you. I was going crazy about this. :-) I will close the issue.

zreptil commented 4 years ago

@quizzmaster is right. The values are not calculated by summing the columns, but by using all values within the period and calculating the averages. So the values are really correct, but you cannot calculate them by using the values in the table. This will almost every time give another value.