← Back to team overview

dhis2-users team mailing list archive

Re: Program Indicator calculations, Converting Dates in Months or Years

 

Thanks Prosper and team,
This is helpful too. 

    On Friday, November 4, 2016 1:59 PM, Prosper BT <ptb3000@xxxxxxxxx> wrote:
 

 Hi Andrew,See this related emails from Markus

.....The d2:yearsBetween() is not yet supported in the server side aggregation of program indicators. For now you would have to use d2:daysBetween() / 365 - which is not 100% correct as the leap years is not considered. You wrote d2daysBetween in your mail below(without the colon between d2 and daysBetween), but i assume that was a typo in the mail. If you used the expression d2:daysBetween(A{ yourDateOfBirthAttributeUID}, V{event_date}) / 365 that should work fine on both the server and client side. Let me know if this was the expression you tried. Note that the attribute UID should be prefixed with A. 
In the dev instance the example indicators on the MNCH / PHC program use the V{event_date} as basis for the age calculation. This causes the indicators to be calculated to NaN until you enter an event date. If you do not explicitly want the age at the event, you can use V{enrollment_date} instead.
Markus
P.S. The attributes of type date is not shown in the expression part of the Program Indicator UI, only in the filter further down. This is all getting reworked and sorted out soon, but as a workaround for avoiding typos you can add the attribute in the filter part of the UI then cut'n'paste.
Prosper Behumbiize, MPH
DHIS2 Implementation| HISP Uganda/University Of Oslo
+256 752 751 776 | +256 776 139 139prosper@xxxxxxxxxxxxxx | prosper@xxxxxxxxx | Skype: prospertb
On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland <lars@xxxxxxxxx> wrote:

Hi Andrew,
how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.
Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?
best regards,
Lars




On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew <muhireandrew@xxxxxxxxx> wrote:

Dear All,
We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type. 
Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years. 



-- 
Lars Helge Øverland
Lead developer, DHIS 2University of OsloSkype: larshelgeoverlandlars@xxxxxxxxx
http://www.dhis2.org




   

References