Hi Sakibou,

I can't think of in any simple way to do this, but below is a possible
workaround.

There is a Jira "Epic" at https://jira.dhis2.org/browse/DHIS2-3187 to track
use cases for possible extensions to analytics expressions (like the
expressions for Indicator and Program Indicator). As part of this, we will
also be considering possible extensions to predictors. If anyone has needs
that might be met by additional abilities of these expressions, please
create a Jira ticket and let me know.

The possible workaround:

Do you have a maximum number of periods you want to look back? Let's say
you want to look back for a maximum of 5 periods. You could create 5
predictors to copy these values into the current period:

Predictor Previous1, sequential sample count = 1, outputs to PreviousData1.
Predictor Previous2, sequential sample count = 2, skip count = 1, outputs
to PreviousData2.
Predictor Previous3, sequential sample count = 3, skip count = 2, outputs
to PreviousData3.
Predictor Previous4, sequential sample count = 4, skip count = 3, outputs
to PreviousData4.
Predictor Previous5, sequential sample count = 5, skip count = 4, outputs
to PreviousData5.

Then create another predictor with some IF logic, like:

IF( ! ISNULL(PreviousData1) && PreviousData1 != 0, PreviousData1,
IF( ! ISNULL(PreviousData2) && PreviousData2 != 0, PreviousData2,
IF( ! ISNULL(PreviousData3) && PreviousData3 != 0, PreviousData3,
IF( ! ISNULL(PreviousData4) && PreviousData4 != 0, PreviousData4,
IF( ! ISNULL(PreviousData5) && PreviousData5 != 0, PreviousData5, 0 ) ) ) )
)

You will need to make sure the first 5 predictors run for a period before
the last one does.

Cheers,
Jim


On Thu, Mar 22, 2018 at 8:59 PM, Sakibou ALASSANI <sakibou.al...@yahoo.fr>
wrote:

> Hi,
> Please I want to know if Predictors can do that or if not what is the
> workaround.
> I want to SUM 2 past value for one dataElement, but only for 2 periods
> where I have Data not ZERO or NULL.
>
> Use case: to generate data in March. we can SUM ( Feb + Jan) . But If no
> data for example in January, How automaticaly Take December Data if not
> Take November data.
>
> Thank you.
>
>
> *----*Sakibou
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Jim Grace
Core developer, DHIS 2
HISP US Inc.
http://www.dhis2.org <https://www.dhis2.org/>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to