Advertisement

11.05.2007 at 11:11AM PST, ID: 22939927
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Query to Calculate Due Date - Where do they come up with These?

Asked by dbbishop in MS SQL Server

Tags: , , ,

I am creating a query that is the source of a DTS transformation to load an Excel spreadsheet. It is account data that has rejected from our billing system. There is an Account, Reject Date, and other data. The first requirement was that I calculate a Due Date that is [RejectDate] + 7 days. No problem.

The specs then changed to say that the due date is the oldest reject date within 7-days of the most recent reject date + 7 days.

Example (in the date order in which data is received):
ID      Acct       RejectDate    Calculated Due Date
01     Acct1     10-18-2007    10-25-2007
02     Acct1     10-20-2007    10-25-2007 (because 10-18 is within 7 days of 10-20, so use 10-18 + 7)

based on this example, if I had
03    Acct1     10-26-2007, you would expect a due date of 10-27-2007 (10-20 is within 7-days, so use that date + 7 days)

However, the specs have changed now. If the immediately previous record (ID=02), is within a 7-day window of a record prior to it (which is the case, with ID=01), and the new record (ID=03) is outside the window of the first record (ID=01), then start over, so ID=03's Due Date should be 10-26 (its reject date) + 7-days.

The logic is that we have a seven-day window to work rejects. Any new rejects for the same account that come in during that window can be considered as being worked within that same window. However, new that comes in outside the 'original' 7-day window is given another 7-days to be worked.

For a clearer example (and maybe to add even more confusion) the following sequence might help make it clearer (AcctID is just an identity column) and this represents 10-days of rejects fro the same account:

[AcctID]   [Account]   [RejectDate]   [Calculated Due Date]
1             Acct001      10-01-2007    10-07-2007
2             Acct001      10-02-2007    10-07-2007
3             Acct001      10-03-2007    10-07-2007
4             Acct001      10-04-2007    10-07-2007
5             Acct001      10-05-2007    10-07-2007
6             Acct001      10-06-2007    10-07-2007
7             Acct001      10-07-2007    10-07-2007
8             Acct001      10-08-2007    10-14-2007
9             Acct001      10-09-2007    10-14-2007
10           Acct001      10-10-2007    10-14-2007

FYI, DUE DATE is calculated at the time the query is run each day and I have not had any problem with either of the first two request, but this latest one is giving me headaches. If it would GREATLY facilitate the query to add a Due Date column to the table, I would be willing to do that as a last resort.Start Free Trial
[+][-]11.05.2007 at 11:38AM PST, ID: 20218815

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 11:51AM PST, ID: 20218932

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 11:52AM PST, ID: 20218936

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 12:19PM PST, ID: 20219128

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 12:21PM PST, ID: 20219149

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 12:28PM PST, ID: 20219207

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 02:19PM PST, ID: 20220030

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 08:00PM PST, ID: 20221327

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: calculate, date, query, due
Sign Up Now!
Solution Provided By: yuching
Participating Experts: 4
Solution Grade: A
 
 
[+][-]11.05.2007 at 08:16PM PST, ID: 20221360

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 11:57PM PST, ID: 20222019

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11.06.2007 at 04:31AM PST, ID: 20223223

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_EXPERT_20070906