This is exactly what I needed. Just tested it. I did not expect to have to specify the group set (even if I can understand). Great, thanks.
On Fri, Jan 20, 2017 at 4:30 PM, Jan Henrik Øverland <j...@dhis2.org> wrote: > Hi Martin, > > Keep Sierra Leone as the "ou" and simply add filter=J5jldMd8OHv:CXw2yu5fodb > where J5jldMd8OHv = Facility type (dimension) and CXw2yu5fodb = CHC > (dimension item). > > https://play.dhis2.org/demo/api/25/analytics.json? > dimension=dx:Uvn6LCg7dVU&dimension=ou:ImspTQPwCqd& > dimension=pe:LAST_12_MONTHS&filter=J5jldMd8OHv:CXw2yu5fodb > > You can easily replicate that in the pivot tables app by finding the > Facility type tab to the left, select CHC only, then open the layout window > and move Facility type to "filter". > > Like you said, the OU_GROUP keyword will explicitly select the orgunits in > the specified group(s) instead. > > Jan > > On 20 January 2017 at 16:15, Martin Van Aken <mar...@joyouscoding.com> > wrote: > >> Hello everyone, >> I've a question on the analytics API. If I want to get a result for a >> single org unit, I can do something like this: >> >> https://play.dhis2.org/demo/api/analytics.json?dimension=dx: >> fbfJHSPpUQD&dimension=pe:LAST_MONTH&dimension=ou:ImspTQPwCqd >> >> (in this case, asking for the ANC 1st visit result for the last month for >> the Sierra Leone country). >> >> This is actually giving me the aggregation of all the org unit in the >> country, as per the documentation: >> >> "For the organisation unit dimension the dimension items are the >> organisation units and their sub-hierarchy - data will be aggregated for >> all organisation units below the given organisation unit in the hierarchy." >> >> Now in my case, I would like to run the same query (result for the whole >> country), but limiting the org unit to a given group - let's say the CHCs. >> The thing is: I don't want the results for each CHC, but still a single >> result at the top level - I just want to include only the CHC in the >> aggregation. >> >> Can this be expressed using the DHIS2 API? I've the feeling I could use a >> filter there, but could not manage to make it work. >> >> Attempting to add filter=ou:OU_GROUP-CXw2yu5fodb to the above query >> result to the API returning an error as: "Dimensions cannot be specified as >> dimension and filter simultaneously" - and I don't see how I can say "give >> me the aggregate for all units under Sierra Leone that are part of the CHC >> group". >> >> Any help or pointer would be most welcome. >> >> Martin >> >> -- >> *Martin Van Aken - **Freelance Enthusiast Developer* >> >> Mobile : +32 486 899 652 >> >> Follow me on Twitter : @martinvanaken <http://twitter.com/martinvanaken> >> Call me on Skype : vanakenm >> Hang out with me : mar...@joyouscoding.com >> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken >> Company website : www.joyouscoding.com >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dhis2-users >> Post to : dhis2-users@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dhis2-users >> More help : https://help.launchpad.net/ListHelp >> >> > > > -- > Jan Henrik Øverland > Software developer, DHIS 2 > University of Oslo > http://www.dhis2.org <https://www.dhis2.org/> > -- *Martin Van Aken - **Freelance Enthusiast Developer* Mobile : +32 486 899 652 Follow me on Twitter : @martinvanaken <http://twitter.com/martinvanaken> Call me on Skype : vanakenm Hang out with me : mar...@joyouscoding.com Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken Company website : www.joyouscoding.com
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-users Post to : dhis2-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-users More help : https://help.launchpad.net/ListHelp