Program Indicator to Count Without Returning 0

Hello all,

Does anyone have advice or insight on how to calculate a program indicator across multiple text data elements that does not return a 0 value.

For example, we have multiple data elements we would like to count if they meet a certain critera ( == ‘option code’). However, if the condition is not met to remain blank (or null).

Using dhis2 version 2.33.4 We have tried using the following expression formulas:

d2:condition("#{dataElement 1} == ‘optionCode’",1,0) + d2:condition("#{dataElement 2} == ‘optionCode’",1,0) + d2:condition("#{dataElement 3} == ‘optionCode’",1,0)

And replacing the ‘0’ with null, ‘null’, “null”, NULL, ‘NULL’, “NULL”, NA, ‘NA’, “NA”, blank, ‘’, “”.

d2:countIfCondition(#{dataElement 1}== ‘optionCode’),1) + d2:countIfCondition(#{dataElement 2} == ‘optionCode’),1) + d2:countIfCondition(#{dataElement 3} == ‘optionCode’),1)

d2:countIfValue(#{dataElement 1}== ‘optionCode’),1) +d2:countIfValue(#{dataElement 2} == ‘optionCode’),1) + d2:countIfValue(#{dataElement 3} == ‘optionCode’),1)

None of these worked.

This is useful for our team because when visualizing our indicators that use the expression above in a pivot table, we see 0’s where we’d like to see blanks.