Assistance required: Filtering tracked entity attributes in a program indicator

Hi everyone,

In my tracker capture, I have HouseID as an attribute. Registering three people who live in the same household means registering the same HouseID three times. I want to write a program indicator to count the number of HouseIDs but I am facing a problem. How can I eliminate repeated houseids in a PI?

Any help would be appreciated.

@dmbantu, have you tried counting TEI?

But how did you setup your tracker capture?
did you create a repeatable stage that allows you to capture information on the household member?
I’m assuming you also need to count the number of members per houseid?


Hi @jesplana,

This is how I setup the tracker capture

I have the following attributes for enrollment:





Program stages

I have created three non-repeatable program stages (A,B and C) to capture information on the household member. An activist goes from house to house and collects data on paper forms. This data is then entered in the dhis 2.

Let’s assume the following data has been entered in the tracker.

Household A
registration Date, Name, Gender,HouseId
2020-09-09, John Manave, Male, A32
2020-09-10, Mary Maposse, Female,A32
2020-09-11, Gill Staque, Male, A32

Household B
registration Date, Name, Gender,HouseId
2020-09-09, Phil Camargo, Male, B22
2020-09-10, Mil Victor, Male,B22
2020-09-11, Juliana Macas, Female, B22

I need to count the number of houseIDs without repetition. From the example above, I should 2 as the result of count. 1 for household A e 1 for household B as the iDs are repeated.

I do not need to count the number of members per housed. Apart from counting HouseIds, I need to count members who participated in each stage.


Looking at your use case, this looks like it can be done by count_tei in the program indicators. As you are only counting the registered household and they are a tracker entity instance.

Your tracker program contains the following metadata:

You have a tracker entity instance id associated to every registration. in your case, Household A and HOusehold B contains a unique tracked entity.
So when you run a program indicator counting TEI, you will get a result of 2.


Hi @jesplana,

The program indicator counts duplicates even if using count_tei. The PI I have built is as follows

Aggregation type: count
Analytics type enrollment
Expression: V{tei_count}


I get 6 as a result, not 2 as expected.

I value the help you’ve given me