SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Return # of Days by Year from Date Fields
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

RickyS
Starting Member

1 Posts

Posted - 12/03/2013 :  10:57:34  Show Profile  Reply with Quote
I need to associate aggregate gross_revenue with calendar year, but do not have a date field that reflects payment dates, just contract periods a start_date and an end_date. The contract periods are typically 1 or 2 years and can start at any time I.e start_date 6/1/2012, end date 5/31/13. I think by finding the number of days that fall in each calendar year and storing in a temp table, I can create a simple formula to associate revenue to each year. Just not sure how to do it, any help would be greatly appreciated.

Lamprey
Flowing Fount of Yak Knowledge

4360 Posts

Posted - 12/03/2013 :  12:32:57  Show Profile  Reply with Quote
First, here are some links on how to ask your question so we can help you better. That includes sample data and expected output:

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

What do you want for output given those two dates?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/03/2013 :  23:36:56  Show Profile  Reply with Quote
quote:
Originally posted by RickyS

I need to associate aggregate gross_revenue with calendar year, but do not have a date field that reflects payment dates, just contract periods a start_date and an end_date. The contract periods are typically 1 or 2 years and can start at any time I.e start_date 6/1/2012, end date 5/31/13. I think by finding the number of days that fall in each calendar year and storing in a temp table, I can create a simple formula to associate revenue to each year. Just not sure how to do it, any help would be greatly appreciated.


Even with that, how would you determine what portion of revenue should go to each of the months? is it based on number of days?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000