DE Average aggregation type returns average of category options as Total

Hi all,

we have observed that when we set aggregation type in a DE collected with category options, when we ask for the total value we obtain the average of the values introduced in each category instead of the sum.

Please see the example bellow. It is configured and tested in the demo server now. It will disappear tomorrow… I’m sending also screenshots.

We would like to know if this is the intended behaviour before reporting it in Jira.

Cheers,

Marta

**Configuration of DE: **

Test_HIV_Average has aggregation type Average

Test_HIV_AverageSum has aggregation type Average (sum in hierarchy)

Data entered

Resulting values

Please notice that we are not aggreating in this examples, neither in time or hierarchy.

Pivot table Test Average Aggregation - Totals

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=R27At0VRELN

image

Pivot Table Test Average Aggregation - Details

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=XIkxuP2unBJ

Hey Marta,

thanks for bringing this up.

I guess the naming of the aggregation operator “Average (Sum in hierarchy)” is currently a bit misleading. It should perhaps have been “Sum (Average in time)”, as we currently sum across the category dimensions.

So yes, it can be argued that the current behavior is wrong. However I am not sure if we should change it (perhaps instead alter the name of the operator). A typical use-case for this aggregation operator is population or staff data. Think about a case where HR data is collected quarterly at a facility:

Quarter 1

Doctors: 10

Nurses: 10

Quarter 2

Doctors: 10

Nurses: 10

Quarter 3

Doctors: 20

Nurses: 20

Quarter 4

Doctors: 20

Nurses: 20

Here HR/staff is a data element, and the types of staff are category options.

In this case, when aggregating for the year and for an entire country, you could like the aggregated value for the HR data element to be 30, by summing up the org units and category options, but averaging across the quarters.

Do you have a specific requirement for the behavior where you need to sum in the org unit hierarchy and average across all other dimensions, or is it more to point out unexpected behavior/possible bug? I am willing to rename the aggregation operator to make it clearer.

Would be interesting to get others input on this as well.

best,

Lars

image

···

On Wed, Jan 11, 2017 at 11:48 AM, Marta Vila martavila@gmail.com wrote:

Hi all,

we have observed that when we set aggregation type in a DE collected with category options, when we ask for the total value we obtain the average of the values introduced in each category instead of the sum.

Please see the example bellow. It is configured and tested in the demo server now. It will disappear tomorrow… I’m sending also screenshots.

We would like to know if this is the intended behaviour before reporting it in Jira.

Cheers,

Marta

**Configuration of DE: **

Test_HIV_Average has aggregation type Average

Test_HIV_AverageSum has aggregation type Average (sum in hierarchy)

Data entered

Resulting values

Please notice that we are not aggreating in this examples, neither in time or hierarchy.

Pivot table Test Average Aggregation - Totals

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=R27At0VRELN

Pivot Table Test Average Aggregation - Details

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=XIkxuP2unBJ


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

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@dhis2.org

http://www.dhis2.org

Hi Lars,

thank you for your answer. I understand that you describe the use of Average (sum in hierarchy). We actually use it for population, beds in the hospital… Also I like the name and the agg. operator :wink:

However, what I was pointing out was the behaviour of the aggregation type “Average”, in contrast with “Average (sum in org.unit)” without any aggregation neither in time or in the hierarchy.

They behave differently and I was wondering if it is done on purpose. Maybe my introduction was misleading.

Let me copy it again.

I do have a use case in which I need average in time, average in hierarchy, and still keep the value of the Data Element as the sum of the values entered in the category options.

Cheers,

Marta

image

···

On 27 January 2017 at 10:35, Lars Helge Øverland lars@dhis2.org wrote:

Hey Marta,

thanks for bringing this up.

I guess the naming of the aggregation operator “Average (Sum in hierarchy)” is currently a bit misleading. It should perhaps have been “Sum (Average in time)”, as we currently sum across the category dimensions.

So yes, it can be argued that the current behavior is wrong. However I am not sure if we should change it (perhaps instead alter the name of the operator). A typical use-case for this aggregation operator is population or staff data. Think about a case where HR data is collected quarterly at a facility:

Quarter 1

Doctors: 10

Nurses: 10

Quarter 2

Doctors: 10

Nurses: 10

Quarter 3

Doctors: 20

Nurses: 20

Quarter 4

Doctors: 20

Nurses: 20

Here HR/staff is a data element, and the types of staff are category options.

In this case, when aggregating for the year and for an entire country, you could like the aggregated value for the HR data element to be 30, by summing up the org units and category options, but averaging across the quarters.

Do you have a specific requirement for the behavior where you need to sum in the org unit hierarchy and average across all other dimensions, or is it more to point out unexpected behavior/possible bug? I am willing to rename the aggregation operator to make it clearer.

Would be interesting to get others input on this as well.

best,

Lars

On Wed, Jan 11, 2017 at 11:48 AM, Marta Vila martavila@gmail.com wrote:

Hi all,

we have observed that when we set aggregation type in a DE collected with category options, when we ask for the total value we obtain the average of the values introduced in each category instead of the sum.

Please see the example bellow. It is configured and tested in the demo server now. It will disappear tomorrow… I’m sending also screenshots.

We would like to know if this is the intended behaviour before reporting it in Jira.

Cheers,

Marta

**Configuration of DE: **

Test_HIV_Average has aggregation type Average

Test_HIV_AverageSum has aggregation type Average (sum in hierarchy)

Data entered

Resulting values

Please notice that we are not aggreating in this examples, neither in time or hierarchy.

Pivot table Test Average Aggregation - Totals

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=R27At0VRELN

Pivot Table Test Average Aggregation - Details

https://play.dhis2.org/demo/dhis-web-pivot/index.html?id=XIkxuP2unBJ


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

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@dhis2.org

http://www.dhis2.org