← Back to team overview

dhis2-devs team mailing list archive

Re: Average (sum in org unit hierarchy) not working in 2.24 and 2.25?

 

Hi Jose,

On Sat, Nov 19, 2016 at 7:57 AM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
wrote:

>
> Great news! Thanks Lars.
>
> Would it be possible to also fix this for 2.25?
>

Yes it was fixed in 2.25 (when writing 2.24 -> master I mean starting from
2.24 including all versions up to master).


>
> And about the rounding problems... is there any solution for that?
>
> [image: Inline image 1]
>
> With periods as filters, we get 10.2 instead of 10..
>
> [image: Inline image 2]
>
>
This is (believe it or not) intentional per now. The reason is that when
calculating average scores we weigh data values by the number of days in
their periods. So in this case we get:

((20×31)+(0×30)) ÷ 61 = 10,1639 ~~ 10,2

This because October has 31 days, September has 30 days (total 61). This
looks a bit strange but is correct according to the way the system
calculates averages (the null value discussion aside).

We need to weigh values by days. As an example, when asking for a yearly
average, there might be data which is both monthly and quarterly - a
quarterly data should impact the average more than a monthly data etc. So
this looks a bit strange with the monthly values but is a product of
different days in months.



Lars






> Thanks Lars!
>
> On Thu, Nov 17, 2016 at 4:49 PM, Lars Helge Øverland <lars@xxxxxxxxx>
> wrote:
>
>> Hi Jose,
>>
>> these issues should be fixed now (same problem as previous issue).
>>
>> regards,
>>
>> Lars
>>
>>
>>
>>
>>
>> On Fri, Nov 11, 2016 at 5:11 AM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>> wrote:
>>
>>>
>>> More info about this...
>>>
>>> We only have data for October 2016 (20), and September 2016 (4). If I
>>> select periods as a filter, this is what happens:
>>>
>>> 1) Last month. The value should be 20!!
>>>
>>> [image: Inline image 1]
>>>
>>> 2) Last 3 months, last 6 months, and last 12 months, gives 24.7. It
>>> calculates the sum (with the strange 0.7), no the average.
>>>
>>> [image: Inline image 2]
>>>
>>> 3) This Quarter (approx, the real result should be 6.666)
>>>
>>> [image: Inline image 3]
>>>
>>> 4) Last Quarter (correct!)
>>>
>>> [image: Inline image 4]
>>>
>>>
>>> 5) This six-month (approx, the result should be 4. Don't understand why
>>> the addition of 0.1 as the results of divisions are integers)
>>>
>>> [image: Inline image 5]
>>>
>>> 6) This year (correct!)
>>>
>>> [image: Inline image 6]
>>>
>>>
>>> Will be great to have your feedback, as this is very urgent for us! :) .
>>> It seems it works well (but with some rounding problems) when the periods
>>> selected in the analytics are quartes, six-months, years, etc. but no for
>>> months (that calculates the total).
>>>
>>> Many thanks
>>> Jose
>>>
>>> On Tue, Nov 8, 2016 at 2:19 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>>> wrote:
>>>
>>>>
>>>> Dear devs,
>>>>
>>>> I have the 'test' dataelement which its Agregation type is 'Average
>>>> (sum in org unit hierarchy)', however it doesn't seem to calculate the
>>>> average for periods. For example
>>>>
>>>> [image: Inline image 1]
>>>>
>>>> if a select the period as filter I suppose I should get 12 right?
>>>> However, what I get is:
>>>>
>>>> [image: Inline image 2]
>>>>
>>>> 24.7 that I don't understand. Am I doing something wrong? Is it a bug?
>>>> This is very urgent for us. If it is a bug, we would need a fix for both,
>>>> 2.24 and 2.25. Would that be possible?
>>>>
>>>> Sum accross org. unit tree seems to be ok
>>>>
>>>> Thanks much
>>>> Jose
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Lars Helge Øverland
>> Lead developer, DHIS 2
>> University of Oslo
>> Skype: larshelgeoverland
>> lars@xxxxxxxxx
>> http://www.dhis2.org <https://www.dhis2.org/>
>>
>>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
lars@xxxxxxxxx
http://www.dhis2.org <https://www.dhis2.org/>

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image


References