As Abyot stated, using the “Age” value type does work great for calculating the date of birth from the age (either months years or days, none are compulsory) and you don’t need a formula. You just need to change the value type of your “Date of birth” attribute from “date” to “age”
If I remember correctly there are some issues with using this in some versions of DHIS2 ( For example, when using a format different than YYYY-MM-DD, will update the post when I find the right Jira with the limitations)
Edit: here are the Jira tickets:
[DHIS2-11413] - Jira (unresolved)
[DHIS2-6336] - Jira (fixed for 2.34 onwards)
How to add a checkbox: You will need to create an attribute that is “yes only” and add it to your program attributes
How to calculate a date from years:
If you don’t use the Age value type and instead do this straight from an attribute where the age is stored in years, you will have to create a series of programme rules. Here is a good example (Using add d2:addDays)