I can’t figure out how to create a program indicator that will count only once the selected option set values of text data element in a repeatable program stage.
Data element: Test Result with these options: “positive, Negative, Not applicable”. What I want is that test result negative be counted only once even if selected multiple times in a repeatable program stage.
Any guidance would also be useful on how to achieve the same result in non reparable program stages.
It sounds like what you want is an enrollment type program indicator with d2:countIfValue function.
For example, try enrollment type indicator, expression V{enrollment_count}, filter d2:countIfValue([ programStageUID ].[ TestResultDataElementUID ], ‘Negative’) >= 1 EDIT: proper syntax uses comma to separate stage and data element UIDs from the counted value.
This would count all enrollments where there is at least one Test Result (repeatable program stage) marked negative. The same approach would also work for non repeatable stages.
NB: By default, an enrollment type program indicator will use the enrollment date to determine the period each enrollment filters into. If some test results occur, say, 6 months after enrollment, and you want to count each enrollment with at least one negative test result in a given month, then you can use a custom program indicator period boundary, which would includes boundaries for event date as well as enrollment date.
More information about program indicator filters and period boundaries is available here.
After separating the UID and the value with a comma, the filter gets validated but when I try to view the PI in the pivot table, I see no value. I have run the analytics.
I have registered two entities as test data for August. 1 has tested negative in three visits and the other has tested negative in the first two visits and positive in the 3r/last visit.
I ticked the display in form checkbox and the indicator shows 1 in the dashboard.
You have said that, “By default, an enrollment type program indicator will use the enrollment date to determine the period each enrollment filters into.” This has held my attention and I would to like to know what event-date means in relation to Program indicators building. Building program indicators has led to some confusion as I do not have much experience in this area.
Hi @hernandezmachava it might be worth creating a new indicator with this same filter and trying again, or selecting different period dimensions. In later versions the pivot table cache does not always clear correctly for program indicators within the browser. But it may be working correctly since, as you say, the “display in form” indicator is showing correctly in the TEI dashboard.