← Back to team overview

dhis2-devs team mailing list archive

Analytics - indicators with null vs 0

 

Hi, I’m seeing some strange behaviour in analytics result with regards to «null» vs 0 results. This is in 2.24.

I have some indicators which are the sum of 1, 2 or more data elements. Zero is significant in this case, so zero value storage for data elements is enabled. For these indicators, I need to see:
- if data elements being summed up are all blank, indicator should be blank
- if at least one data element being summed is 0 and the others blank, indicator should be 0
- if there are values > 0 being summed, indicator should be the sum

Now the part that is confusing me: 
IF I make an analytics call with one orgunit, one indicator and several periods (all set as dimensions), this works as expected: periods where the indicator should be null is left out of the result, indicators that should be 0 or more are displayed correctly. HOWEVER, as soon as I include more orgunits or more indicators, and any of these have values in the period that was initially blank, the indicator value that was previously left out is suddenly included with value 0.0, so that it is not possible to differentiate between null and 0. HOWEVER, it looks like adding additional data elements does not have the same effect…

I’m not sure if the explanation make sense, but in short I need advice one how to query multiple orgunits and data items for multiple periods, and be able to differentiate blank and 0?