# Percentage Calculation

Pl. See Code Snippet1278892
``````Sql Server 2005

The result of a tsql is

tmtr    aMtr    bMtrpercentage  years   months
----------------------------------------------
4431	4380	51	0.988490	2010	7
8946	8946	0	1.000000	2010	8
1179	1083	96	0.918575	2010	10
----    -----   ----
14556   14409   147
-----   -----   -----

1. Total of Tmtr is 14556
2. Total of Amtr is 14409
So the Percentage of Amtr is calculated as 14409/14556 = 98.99%

But why this do not reconcile with (0.9884+1.00+0.9185)/3 = 96.89%

The percentage difference is 2.10

Why is there difference?
``````
Microsoft SQL Server

Last Comment
Mehram

8/22/2022 - Mon
raulggonzalez

Because mathematically they are different....

You have to do the percentage of your totals, not the average of the partial amounts.

Cheers
raulggonzalez

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
lomo74

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Mehram