Hi,

Is there any way in analytic api to select latest data value for aggregation ? 
As per example:

orgUnitParent -> child1,child2
dataElement [number] de1
dataSet [monthly] -> de1

dataValue: de1 -> child1 -> 2017-03-01 -> value = 10
dataValue: de1 -> child2 -> 2017-03-01 -> value = 4

At this stage analytic api call for orgUnitParent, dx:de1 ou:orgUnitParent 
pe:THIS_YEAR ->   "rows": [ [ “de1”, "2017”, “orgUnitParent”, “14" ] ], 14 is 
good but lets POST another value:

dataValue: de1 -> child2 -> 2017-05-01 -> value = 6

Now analytic api call for orgUnitParent, dx:de1 ou:orgUnitParent pe:THIS_YEAR 
->   "rows": [ [ “de1”, "2017”, “orgUnitParent”, “20" ] ], 20 .. sums all data 
values… we need just sum of the latest values, i.e 16

I have read: https://lists.launchpad.net/dhis2-users/msg13042.html 
<https://lists.launchpad.net/dhis2-users/msg13042.html> it’s programs/event 
setup, and the answer didn’t seem to help me.  Reading the documentation I 
assume there is not LATEST relative period, and currently we have to do the 
following to get the desired result:

orgUnitGroup -> child1, child2

Analytic api call dx:de1 ou:OU_GROUP:orgUnitGroup pe:THIS_MONTH;LAST_12_MONTH 
-> "rows": [[ “de1”, "201703”, “child1”, “10” ],  [ “de1”, "201703”, “child2”, 
“4” ], [ “de1”, "201705”, “child2”, “6” ]] -> after that our server in between 
front end and dhis2 instance does the aggregation manual based on latest value 
for OU.. 

It would be awesome if there was another option since we are using DHIS2 
because of it’s aggregation capabilities.

Appreciate your helpful response,

Andrei @ Sussol

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to