Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Calculation Issues

Author  Topic 

jmantheiy
Starting Member

3 Posts

Posted - 2007-05-24 : 08:48:39
I am getting incorrect results back when I do the following query and not really sure why. Below is the query and some additional details.

query: 100*((ACT_AHT - FC_AHT) / FC_AHT)
calc: 100*((347.6 - 316.479) / 316.479)
expect result rounded = 9.83
actual result rounded = -8.47

All fields are defined as floats. The error seems to happen when I add the divide by.

Joe
[url]http://www.ilearneditonline.com[/url]

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-24 : 08:59:06
hmm....
SELECT 100*((347.6 - 316.479) / 316.479)

gives 9.8335118600 to me...

are you sure you are looking at correct data?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

jmantheiy
Starting Member

3 Posts

Posted - 2007-05-24 : 09:05:27
I am absolutely positive I am looking at the right data. That is why I am asking for help. I don't have a clue where to go from here.
Go to Top of Page

jmantheiy
Starting Member

3 Posts

Posted - 2007-05-24 : 09:16:35
Sorry, I found my problem. ACT_AHT and FC_AHT were numbers I had to calculate to get the actual numbers. My calc should have been 100*(((ACT_AHT/ACT_CALLS) - (FC_AHT/FC_CALLS)) / (FC_AHT/FC_CALLS))

Blog: [url]http://www.ilearneditonline.com[/url]
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-24 : 09:28:34
see... your data was flawed

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -