Program Indicator filter expression when combining data elements and attributes

I have created a program indicator to measure the number of people (V{tei_count}) who have received at least one service (recorded as a series of data elements). A simplified version of the filter is:

(data element PMTCT== 1) ||(data element PEP== 1) ||(data element PREP== 1)

This works.

However, i now want to have the same indicator, but for it to only count the number of females reached with at least one of these services. This uses an Option (female) in the Option Set (gender) used in Attributes when the person is enrolled. I’ve used the following filter:

(data element PMTCT== 1) ||(data element PEP== 1) ||(data element PREP== 1) && Gender == ‘female’

However this does not return the correct result. It does have a green tick to say the syntax is correct, but when i run the report, it is returning the same result as before i disaggregated it (so if the total for the previous programme indicator is 100, when disaggregated by gender it returns 100 for both male and 100 for female which clearly isn’t right). I’ve checked the correct option set and option code has been used. Any suggestions of what i’ve done wrong?

thank you!

2 Likes

Hi @adownie
A couple things may be going on here.

First, you should encircle the entire group of data elements with parentheses (). The reason is that your && operand is only attached to the final DE in the list (PREP), meaning a Male with PEP would also be captured by the filter. So you could try:
((data element PMTCT== 1) || (data element PEP== 1) || (data element PREP== 1)) && Gender == ‘female’

Second, you mentioned you had the right option code, is that also the case for the Gender tracked entity attribute? Maybe there is a code used for the Female option that should be used in the filter instead.

4 Likes

Hi @brian , thanks so much for your help. Really helpful to know the brackets are needed- i had wondered about that! I double checked and it turns out i had put in the option code wrong- ‘Female’ instead of ‘female’. Good to learn that the syntax is case sensitive!

3 Likes