@Gassim you know I am using a custom data capture app. When a user select an option for DE, the value of that option is hard-coded so each option has a maximum score. The sum of all the maximum score in my example above is 200. So if a user select a value in the DEs, they cannot exceed the maximum score.
So in my equation above,
Numerator = total score of selected options = (DE1 + DE2 + DE3) = 50 + 40 + 90 = 180
Denominator = total maximum score of all DEs = 200.
Say maximum score for DE1 = 50, DE2 = 50 and DE3 = 100. In this case DE1 score 50/50, DE2 score 40/50 and DE3 score 90/100.
So my equation seek to find the percentage of the selected score against the maximum score.
If I go by your suggestion, ((DE1 + DE2 + DE3…) / number of DEs) * 100 it will appear I am taking the average and not the percentage. Actually I have used my formula above in my existing project and it was working fine before I port to DHIS2.
In my case I don’t think I need to enforce the sum not to be greater than 200, because the users are selecting the options and the value for each options are sent to the server. There is no way a user can select a value more than the assign maximum score. So if you look at my indicator above, I assign 200 as the denominator because that is the maximum score that the sum of all DEs can attain even if the user select all the maximum option values.
Talking about program rule, do I need to enforce it for my scenario?
On a closer look, I think the calculation works well at facility level. But when I try to get same at the highest OU hierarchy level, it is now giving me the total of all the percentage at facility level but what I want is average of all the percentage scores.
Is it possible to get the average of all the percentage score from the facilities from the visualizer app at the highest OU hierarchy level?
If you look at the first column in the image above, it is giving me the sum of the percentage score from each facility at the 2nd level of hierarchy where as I need the average of all the percentage scores.
Something I tried out was to create a new indicator to capture the average at the highest org unit level using the sum of all the DEs as numerator and the count of the organisationUnitGroup * max score as denominator. The result seems to come out well but I have not manually confirm if it is correct. However I would have prefer to just get the value using option tab in the app.