# Issues with aggregate data elements with aggregation type: last value

**URL:** <https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202>\
**Category:** Support - Assistance technique\
**Created:** [4 November 2020 21:53 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202 "2020-11-04T21:53:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kris\_Reinhardt](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/kris_reinhardt/32/38606_2.png) [@Kris\_Reinhardt](https://community.dhis2.org/u/Kris_Reinhardt)\
**Post date:** [4 November 2020 21:53 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/1 "2020-11-04T21:53:03Z")

</div>

Hello Experts,

We have a weekly aggregate data set that collects a data element with aggregate type: last value (sum in org unit hierarchy). In our reports, we’re noticing that data is not appearing as expected.

First, is it possible to set the aggregation type of a data element to present the last value **only** for the reporting period that is being presented? For example, I have data only for w35 - w38 2020, were w38 has 0 entered for the value (‘store zero data values’ is set to true for dE). However, in my reports (see screenshot below) I’m seeing the last value from w37 presented for all following weeks and months (this ignores values that are 0 or null). I believe this is reported here already: [[DHIS2-8607] - Jira](https://jira.dhis2.org/browse/DHIS2-8607). **Will this ticket be picked up at some point? Or is there another way to report the last value within the reporting period?**

Second, it seems like data elements with the last value aggregation type are not respecting the ISO calendar. Using the same example explained above and screenshot below, I’m seeing w36 being presented as the last value for August. However, according to the ISO calendar, w35 aggregates to August and w36 aggregates to September. **Is this expected behavior?**

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/4/1/41794c2ea471b842431d201064309db4096b1c2d.png)

We are currently on version 2.33.4

Thanks,  
Kris

---

<div class="post-metadata">

**Author:** ![dmnscar](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/dmnscar/32/37126_2.png) [@dmnscar](https://community.dhis2.org/u/dmnscar)\
**Post date:** [6 November 2020 09:45 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/2 "2020-11-06T09:45:21Z")

</div>

Yes, we are seeing the same problem here (the 1st one), DEs with ‘Last value’ showing values to the end of 2020 which makes the graphs look incorrect.

---

<div class="post-metadata">

**Author:** ![ifeanyiokoye](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/i/ce73a5/32.png) [@ifeanyiokoye](https://community.dhis2.org/u/ifeanyiokoye)\
**Post date:** [4 May 2021 13:12 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/3 "2021-05-04T13:12:11Z")

</div>

This was posted on JIRA

Hi all,

I was investigating this issue, and I realized that this is not a bug.  
It’s a configuration problem, and the following steps should help you to achieve what you’re looking for.

Assuming you’re logged into DHIS2 and have admin rights, please, execute the steps below in this order:

_**1) Go to the ‘Maintenance’ app;**_  
1.1) Select the Data Element you need;  
1.2) Check the box ‘Store zero data values’, as in the image [DHIS\_2\_Maintenance-DE-Store\_Zeros.png](https://jira.dhis2.org/secure/attachment/20732/DHIS_2_Maintenance-DE-Store_Zeros.png);

_**2) Go to the ‘Data Entry’ app;**_  
2.1) Select your Data Element;  
2.2) Select the date where you want to input ZERO;  
2.3) Make this form ‘Incomplete’. See image [DHIS\_2\_Data\_Entry-Make\_Incomplete.png](https://jira.dhis2.org/secure/attachment/20731/DHIS_2_Data_Entry-Make_Incomplete.png);  
2.4) Now, set ZERO to the respective field and click on ‘Complete’, as in the image [DHIS\_2\_Data\_Entry-Make\_Complete\_Again.png](https://jira.dhis2.org/secure/attachment/20730/DHIS_2_Data_Entry-Make_Complete_Again.png);

_**3) Go to the ‘System Settings’ app;**_  
3.1) Go to the ‘Analytics’ tab;  
3.2) Uncheck ‘Skip zero data values in analytics tables’. See image [DHIS\_2\_Analytics\_Do\_NOT\_Skip\_Zeros.png](https://jira.dhis2.org/secure/attachment/20726/DHIS_2_Analytics_Do_NOT_Skip_Zeros.png);

_**4) Go to ‘Data Administration’**_  
4.1) Click on the ‘Maintenance’ tab;  
4.2) Select ‘Clear application cache’;  
4.3) Click on ‘PERFORM MAINTENANCE’, as in the image [DHIS\_2\_Clean\_App\_Cache.png](https://jira.dhis2.org/secure/attachment/20728/DHIS_2_Clean_App_Cache.png);

_**5) Open the ‘Browser Cache Cleaner’ app;**_  
5.1) Click on ‘Select all’;  
5.2) Click on ‘Clear’, and confirm with ‘Proceed’. See [DHIS\_2\_Clean\_Browser\_Cache.png](https://jira.dhis2.org/secure/attachment/20727/DHIS_2_Clean_Browser_Cache.png)

_**6) Go to ‘Data Administration’**_  
6.1) Click on the ‘Analytics Tables’ tab;  
6.2) Click on ‘START EXPORT’. See image [DHIS\_2\_Data-Export\_Analytics.png](https://jira.dhis2.org/secure/attachment/20729/DHIS_2_Data-Export_Analytics.png);

_**7) Finally, open the ‘Pivot Tables’ app;**_  
7.1) Select the respective Data Element;  
7.2) Set the ‘Periods’ to ‘Daily’;  
7.3) Select the dates you want to test;  
7.4) Uncheck the default period ‘Last 12 months’;  
7.5) Select the correct ‘Org Unit.’;  
7.6) Click on ‘Update’. You should see results similar to this image [DHIS\_2\_Pivot\_Tables-8607.png.](https://jira.dhis2.org/secure/attachment/20725/DHIS_2_Pivot_Tables-8607.png)

- If you still see the same results in ‘Pivot Tables’ is very probable that your local browser is caching the requests.  
In this case, try to clean completely your local cache/data or disable the caching of your browser.

If you would like to learn more about ‘Skip zero data values in analytics tables’, see this topic of the user’s documentation: [Home - DHIS2 Documentation](https://docs.dhis2.org/master/en/user/html/dhis2_user_manual_en_full.html#system_analytics_settings)

For the Data Element configuration, you can find more at [Home - DHIS2 Documentation](https://docs.dhis2.org/master/en/user/html/dhis2_user_manual_en_full.html#create_data_element) (item 14), and at [Home - DHIS2 Documentation](https://docs.dhis2.org/master/en/user/html/dhis2_user_manual_en_full.html#edit_data_value_in_completed_form), item 4).

I hope that helps you.

Thanks,  
Maikel

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [6 May 2021 07:12 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/4 "2021-05-06T07:12:14Z")

</div>

Thanks for your assistance Dr.Ifeanyi @ifeanyiokoye!

@Kris_Reinhardt@dmnscar does this solve the issue? Please update us with your experiences! Thank you!

---

<div class="post-metadata">

**Author:** ![ifeanyiokoye](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/i/ce73a5/32.png) [@ifeanyiokoye](https://community.dhis2.org/u/ifeanyiokoye)\
**Post date:** [6 May 2021 15:09 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/5 "2021-05-06T15:09:07Z")

</div>

I think the thanks actually belongs to @maikel

Was only just conveying his good work…

Thanks @Gassim

---

<div class="post-metadata">

**Author:** ![Kris\_Reinhardt](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/kris_reinhardt/32/38606_2.png) [@Kris\_Reinhardt](https://community.dhis2.org/u/Kris_Reinhardt)\
**Post date:** [1 October 2021 16:01 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/6 "2021-10-01T16:01:02Z")

</div>

hi @Gassim and all, unfortunately, this is not a solution that will work for us because we do want to skip storing zeros in our analytics tables for the other ~7000 data elements and indicators in our system.

Ultimately, what we want to do is have a weekly data element that presents the values entered for each week as it is entered. On a monthly basis, we would like to present the value that is entered during the last isoweek of the month. On a yearly basis, we would like to present the value that is entered during the last isoweek of the year.

---

<div class="post-metadata">

**Author:** ![ifeanyiokoye](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/i/ce73a5/32.png) [@ifeanyiokoye](https://community.dhis2.org/u/ifeanyiokoye)\
**Post date:** [16 June 2023 11:33 UTC](https://community.dhis2.org/t/issues-with-aggregate-data-elements-with-aggregation-type-last-value/41202/7 "2023-06-16T11:33:46Z")

</div>

Hi, @Kris_Reinhardt you would need to specify just the data elements you need to store zero values and change them in the data element settings. We have done this and it works better for us now. The only thing is that folks have to remember to enter zeros in every field that has no data. Tedious!
