How to change OrgUnit when data were recorded in the wrong OrgUnit

Hi All,
One of the users have recorded datas in a wrong OrgUnit . Is it possible to change only OrgUnit for those datas recorded in the wrong OrgUnit?
Please advise me.

B rgds



Are you referring to aggregated data, event data, or tracker data?


1 Like

Hi Calle,
it is about aggregated data.


1 Like

Hi @nahayofranck,

One way would be to have you export your data, match it to the right Org Unit then import it back to the system. I would however recommend you delete the records you are changing from the system after export before you import it back the edited data.


1 Like


There is no simple way of doing that for aggregated data, regrettably - one of the many user-friendly DHIS1 functions that never made it into DHIS2. For Tracker data there is a half-baked method for moving orgunits, but not for aggregated data.

The method suggested by James works, but it’s cumbersome.

The other methods are

  • using a simple update script
  • using the web api



Just to add to what has already been said here by @Calle_Hedberg and @jomutsani. Method 1 is cumbersome and a little safer (suggested by @jomutsani), while Method 2 - update scripts - (suggested by @Calle_Hedberg) requires more caution but less cumbersome. I’d go for it. That said; If using the SQL update scripts you’d first want to back up you database. Then run updates scripts on 3 tables (maybe more i don’t know but i think these would do)

  • datavalue
  • datavalueaudit
  • completedatasetregistration

You’d also want to note a few things.

  • orgunit ids of the source(wrong orgunit) and destination organization units (correct orgunit)
  • dataset id of the dataset
  • period id for the period for which the dataset was submitted (this can be got from the periodtype and period tables).
  • and probably username of data entrer just to narrow down things

What remains then is writing those SQL queries. You’ll basically be updating orgunit ids in the 3 tables.

Philip Aleu