Absolute Value Aggregate Indicator

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

1 Like

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!

2 Likes

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

1 Like

You’re welcome! :slight_smile: Thanks for marking as solved! I’m happy it works :grin::blush:

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, 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. :+1:

Thanks!

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

1 Like