Increase Age of Pregnant

Hello Team,

I have field name: How many months of preganancy

for example today I type 3.
and next month I want this number is calculate as 4 (increase by months)

please give me an advise on this.

Thank you,

not possible. you can do this in your excel or power bi or whatever you are using to report

Dear Sambo,

Finding/Incrementing the Pregnancy month, would need two pieces of information for precise calculation: the month recorded and either LMP or the month of recording/incrementing. SO in case, you have first time recorded the month of Pregnancy say on 28th Aug and the month was 3. During recall, based on mont of recall, the period can be incremented. If you recall any time (or multiple time in August, then no increment is needed. if you recall in October, then add the month difference to the period. In the current example. Still one question remains: how to find months elapsed as there is not direct function for months in CommCare. For that we can use the following:

the current month number with
format-date(today(), "%Y")
and the current month number with
format-date(today(), "%m")

However, you would require to save the initial entry and period of entry in case properties. Only then you can make a recall

1 Like

I agree with the others saying you should store the date of the last mentrual period and calculate the current months of pregnancy. There are some example calculations you may find useful on this confluence page:

The "Age in months (by day of month)" calculation should do what you're looking for:

(format-date(today(), "%Y") - format-date(#form/dob, "%Y")) * 12
+ (format-date(today(), "%m") - format-date(#form/dob, "%m"))
+ if(format-date(today(), "%d") < format-date(#form/dob, "%d"), -1, 0)
1 Like