# RE: SQL - Calculate 100%

Date: Fri, 26 Nov 2010 17:33:03 -0500

Eriovaldo,

If you round your results then the sum is correct:

3,70 is really 3,7064 and would round to 3,71 - right?

round(value1/value2,2)*100

From: oracle-l-bounce_at_freelists.org [oracle-l-bounce_at_freelists.org] On Behalf Of Eriovaldo Andrietta [ecandrietta_at_gmail.com] Sent: Thursday, November 25, 2010 6:18 PM To: Adam Musch
Cc: ORACLE-L
Subject: Re: SQL - Calculate 100%

It solved part of my issue.
The ratio_to_report helped when I have this situation:

10,90
3,70
85,39
(only one column)

but I also have the situation

```  col1         col2       col3
--------      --------     --------
10,90      3,70       85,39 --> the sum must be 100%
```
(three different columns)

Any other clue ?

I am trying to use DECODE , but the code will not be clear.

Best Regards
Eriovaldo

On Thu, Nov 25, 2010 at 3:08 PM, Adam Musch <ahmusch_at_gmail.com<mailto:ahmusch_at_gmail.com>> wrote: The RATIO_TO_REPORT analytic function appears to be what you're looking for.

On Thu, Nov 25, 2010 at 3:57 AM, Eriovaldo Andrietta <ecandrietta_at_gmail.com<mailto:ecandrietta_at_gmail.com>> wrote: Hi friends,

I have the following situation:

```Value1                     Value2        Value2 / Value1 = Percent

```

4128,00 450,00 10,90
4128,00 153,00 3,70
s4128,00 3525,00 85,39

```Sum Percent ------------------->                    99,99

```

The sum of percent is not 100% ...

Is there any SQL instruction that does this calculation and adjust the value to 100% ?

Regards
Eriovaldo

--