How to make a program indicator to count number of events?

Hi all,

I want to make a program indicator that can count the number of events at a given OU and with dates that fall within a given period. How can I configure this? I am using version 2.35.

I tried using d2:count in the indicator expression, but this does not work. If I view this indicator in the data visualizer and select an OU, it gives me the total number of events for the entire OU hierarchy, not the number registered at that specific OU. The same goes if I select a given period - it gives me the total number of events for all periods.

I can’t find any documentation explaining how to configure the indicator correctly, so I appreciate the community’s help!

Thanks in advance,

Maria Guerra-Arias

It’s supposed to normally disaggregate the result for you when you click on the OU and period. Could you add the steps to how you configured the program indicator? And if possible reproduce in an play.dhis2.org instance?

Thanks!

For the indicator expression I used d2:count(#{U9uiTsOcDm4.irbhGhz80X2})

Where #{U9uiTsOcDm4.irbhGhz80X2} is the id for one of the data elements in the event (the name of the event).

I did not change any other default settings for the indicator and did not set up a filter.

Indicators supports only program indicators not the expressions

Thank you

1 Like

Hi @Guerra-Arias_Maria

I looked at this topic, and did some testing my self, and hope this can help you.

I created a program indicator with the following config:
Aggregation type = Count
Analytics type = Event
Analytics period boundaries
Event date - Before end of reporting period
and event date - after start of reporting period

In expression: V{event_count}
In filter: d2:hasValue(#{CWaAcQYKVpq.bl7EMKxJIIT})
Filter saying that the data element need to have a value in the program stage.

In data visualizer when choosing ngelehun I will only get the number of events where the data element has a value, and this seems to count the right number for me. This includes active and completed enrollments and active and completed events

If you want to filter only active events add: && V{event_status} == ‘ACTIVE’ in filter.

Documentation on functions and variables is available here

Could you please test this in your instance?

Caroline

3 Likes

Hi Caroline,

This worked, thank you so much for your help!

Best,

Maria

2 Likes

Hi @Caroline,

  1. What is meant by open, active or completed event/enrollment?
  2. How do we know that an enrollment or an event is still active or inactive, completed or incomplete in the context of repeatable and non repeatable stages.

Thanks