How to Count Only the Latest Status per Tracked Entity in a Multi-Stage Tracker Program? (Event vs Enrollment Analytics Issue)

Hi DHIS2 Community,

I’m implementing a tracker program for project management, with three stages: Planning, Implementation, and Completion. Each tracked entity instance (TEI, e.g., project) passes through these stages in sequence.

Methodology:

  • I use a shared data element “Progress Status” (option set: planned/ongoing/completed) assigned to each stage.
  • At each stage, a program rule sets the Progress Status to the correct value.
  • I want to count projects by their current/latest status, so that each project is counted only under its most advanced stage (not multiple times).

The Problem:

  • When I use event-based program indicators, the same project is counted in every stage/event it has passed—so projects that reached “Completion” are counted as both “Planned”, “Ongoing”, and “Completed”.
  • When I use enrollment-based indicators, referencing a stage-specific data element (e.g., #{StageUID.DataElementUID}) does not always reflect the most recent value.
  • I want to count only the latest status per TEI (e.g., if a project is completed, it should be counted only as completed, not also as ongoing or planned).

Tried Solutions:

  • Assigning the same Progress Status data element to all stages, updating it with program rules.
  • Referencing the data element from the latest stage in the indicator.
  • Using both event and enrollment analytics types, but each results in either double-counting or missing the latest value.

Desired Result:

  • Each project (TEI) should be counted only once, according to its current/latest status, regardless of how many stages it has completed.

Questions:

  1. What is the best practice for achieving “latest status only” counting in DHIS2 tracker programs?
  2. Should I use a Tracked Entity Attribute (TEA) for status and update it in every stage with program rules?
  3. Is there a built-in DHIS2 way to get the “latest event” value for a data element across all stages at the enrollment level?
  4. How do others solve this for project, case, or workflow tracking?

Any advice, best-practice metadata examples, or references to official documentation would be much appreciated!

Thanks in advance,
Gees

Hi @gees

Please what is the version of the DHIS2 instance you are using? The issue of “Program Indicator Calculation Error on Reusing Data Elements Across Program Stages” is fixed for versions (2.41, 2.38.5, 2.39.4, 2.40.3) and above.

If you are using an older version than the ones I listed then the best option is to either use one unique data element for each program stage or to update/upgrade your DHIS2 instance.

You are in the right path creating an enrollment-based program indicator; however, make sure to either create a unique data element for each program stage (or update/upgrade if you are using an older version).

If you are actually using one of the latest versions listed above then I would recommend to still create a unique data element for each program stage.

I would not recommend that because it’s not currently possible to update TEA values based on values in program stages.

I’m looking forward to getting more feedback from you. I hope this helps, thanks!


Hi again @gees ,
Any updates on how you approached this? Looking forward to hearing back from you! Thanks!