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)
 Per Diem Formula

Author  Topic 

saba9
Starting Member

4 Posts

Posted - 2010-05-26 : 13:38:34
Hi, Im not sure if this questions comes in this topic or not. I'm having a hard time calculation per diem formula ( I work in banking industry) so anyone here knows how to calculate it, please help. Thanks

CASE WHEN ratemethod = 'split' AND ((round(balance, 2,1) * -1) > lev2) THEN ((((round(balance,2,1) * -1) - lev2)
* ((POWER((1+ CAST(rate2/100 AS float)),0.083333)-1))*12 /365) + (CAST(lev2 AS money) *
((POWER((1+ CAST(rate1/100 AS float)),0.083333)-1))*12) / 365)
ELSE (((round(balance,2,1) * -1) * ((POWER((1+ CAST(rate1/100 AS float)),0.083333)-1))*12) / 365) END perdiem

I used round shouldve used decimal here, but i can change that, this formula does not give me correct result.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-05-26 : 14:52:36
* 12.0 / 365.0

Beware of integer division


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

saba9
Starting Member

4 Posts

Posted - 2010-05-27 : 08:39:29
Please someone solve this problem. This is the 2nd forum I have posted this question and there is no one knows :/
@Peso: I will fix that error..Thanks
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-27 : 09:06:43
1. Maybe Peso's correction is already the solution?
2. If no one can solve your problem then maybe because of missing some information?
You have stated: "this formula does not give me correct result"
So I think you are able to say what is the expected result.

Input / Processing / Output
You can give Input
You can give wanted Output
With this information then maybe we can fix the Processing


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-05-27 : 09:47:33
Follow the HOW TO ASK link in my signature, and restate your problem after supplying the data we need to help. The link will show you how to supply the data.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -