Dynamic Calculated Value for Age in DHIS2

Hi everyone,

In our registration form, we have:

· Date of Birth (DOB)

· Age in Years — calculated using a program rule.

From what we understand, the calculated Age in Years is static once saved; it doesn’t automatically update over time.

If we use this calculated value in a Program Indicator, it also remains static.

e.g PI expression: initiated AART = yes and calculated value > 20

Question:
How can we have the Age in Years update dynamically (e.g., automatically reflect the current age) in dashboards or reports?

Thanks in advance for any guidance!

Hi @ferdinandmussavene

From my experience, no — you cannot make a calculated “Age” field dynamically update itself once saved in DHIS2.

However, the solution is to calculate age dynamically in analytics using a Program Indicator with the expression like the following:

d2:yearsBetween(A{Date of Birth}, V{analytics_period_end})

This way, the age will always reflect the current value in dashboards and reports

1 Like