# Absolute Value Aggregate Indicator

**URL:** <https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826>\
**Category:** Support - Assistance technique\
**Tags:** aggregate\
**Created:** [30 November 2022 07:39 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826 "2022-11-30T07:39:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asacur](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/asacur/32/35092_2.png) [@asacur](https://community.dhis2.org/u/asacur)\
**Post date:** [30 November 2022 07:39 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826/1 "2022-11-30T07:39:56Z")

</div>

Hi all,  
I have the following question, does aggregated DHIS2 have the possibility of creating an aggregated indicator that returns the absolute value between two data elements?

> Example: 10 - 20 = 10

If so, how can i achieve?

Thanks in Advance

Dhis2 version 2.35.12  
Aggregate

---

<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:** [30 November 2022 17:02 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826/2 "2022-11-30T17:02:28Z")

</div>

Hi @asacur

This is an interesting question! It would be easy to do if we could create a second indicator that uses the value from another indicator but probably this is complex to implement system wise. Therefore, it seems that the only option we have is to make sure the result is expected before the division of the numerator and denominator value.

You only provided one example so to make it easy I will follow the same example. If the denominator value is 1, and the full equation is in the numerator then I’d do something like this:

**if(value1\>value2,(value1-value2)\*-1,(value1-value2))**

This should return the absolute value for this specific equation (with the assumption that the denominator is 1); however, for some other equations it might need a bit more work and thought.

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![asacur](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/asacur/32/35092_2.png) [@asacur](https://community.dhis2.org/u/asacur)\
**Post date:** [30 November 2022 17:11 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826/3 "2022-11-30T17:11:09Z")

</div>

> [@Gassim](#):
>
> if(value1\>value2,(value1-value2)\*-1,(value1-value2))

Many Thanks. Can you provide link where i can learn more about this?  
I was looking how to use ifs in aggregate data.

---

<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:** [30 November 2022 17:17 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826/4 "2022-11-30T17:17:47Z")

</div>

You’re welcome! 🙂 Thanks for marking as solved! I’m happy it works 😁😊

> [@asacur](#):
>
> Can you provide link where i can learn more about this?

I couldn’t find this formula specifically but thought about it; however, the docs mention that [you can use the following functions in an indicator formula](https://docs.dhis2.org/en/use/user-guides/dhis-core-version-master/configuring-the-system/metadata.html#about_indicator:~:text=You%20can%20use%20the%20following%20functions%20in%20an%20indicator%20formula%3A), so it might be a good reference.

Please feel free to post more specific equations that require an absolute value…

It might also be possible to describe the use case and the necessity of adding this as a feature then creating a feature request. 👍

Thanks!

---

<div class="post-metadata">

**Author:** ![asacur](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/asacur/32/35092_2.png) [@asacur](https://community.dhis2.org/u/asacur)\
**Post date:** [30 November 2022 17:34 UTC](https://community.dhis2.org/t/absolute-value-aggregate-indicator/50826/5 "2022-11-30T17:34:12Z")

</div>

> [@Gassim](#):
>
> absolute value

Thank you very much, the link is what I was looking for.

As for the need to get the absolute value, to be honest, I’m not sure what the team intends to analyze… I just have to make it happen one way or another.

Thank you in Advance
