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
 General SQL Server Forums
 New to SQL Server Programming
 Query for Burndown chart

Author  Topic 

infoman
Starting Member

2 Posts

Posted - 2012-09-16 : 10:23:19
Hello all,
I am trying to write a query for a burndown chart that will generate the following result table for me that I can bind to a chart.

Date Ideal Burndown Actual Burndown
9/16/2012 5 5
9/17/2012 4 5
9/18/2012 3 4
9/19/2012 2 3
9/20/2012 1 3
9/21/2012 0 0

I am able to extract how many days of work were completed on any of these days from my tables. For e.g. in the above scenario, the actual completed work would like this:

Date Actual Completed Work
9/16/2012 0
9/17/2012 0
9/18/2012 1
9/19/2012 1
9/20/2012 0
9/21/2012 3


with setrowid (anchordate, completedwork, rowid)
as
(
select anchordate, isnull(completedwork,0) as completedwork,ROW_NUMBER() OVER (ORDER BY anchordate DESC) As rowid
from
(

SELECT CONVERT(Varchar, fnGetDatesInRange_1.Dt, 101) AS anchordate,
burndowndays.completedwork
FROM dbo.fnGetDatesInRange('09/1/2012', '12/04/2012') AS fnGetDatesInRange_1 LEFT OUTER JOIN
burndowndays ON CONVERT(Varchar, fnGetDatesInRange_1.Dt, 101) = CONVERT(varchar,
burndowndays.completiondate, 101)

) dt
)
select * from setrowid
order by rowid desc


In the above query I am able to get the 'Ideal Burndown' using ROW_NUMBER(). How do I now get the 'Actual Burndown' along with this information? I tried inserting into a temp table using a loop, but it became very slow.

I am new to SQL server programming. Any help you can provide me is appreciated.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-16 : 10:33:56
I must admit that after reading your post couple of times, I could not follow what you are trying to calculate. Can you show what your desired output is with an example, and describe in words the logic for calculating that output based on the given input?
Go to Top of Page

infoman
Starting Member

2 Posts

Posted - 2012-09-16 : 15:55:52
Thanks for the reply.
My desired output is as follows:
Date Ideal Burndown Actual Burndown
9/16/2012 5 5
9/17/2012 4 5
9/18/2012 3 4
9/19/2012 2 3
9/20/2012 1 3
9/21/2012 0 0

The data I have in another table that will be used to generate this output is as follows:
Milestone SLA CompletionDate
A 1 9/18/2012
B 1 9/19/2012
C 3 9/21/2012

The table above shows how many days are given to complete the milestone and the actual completion date for that milestone. The burndown chart (output) will show how quickly I went from a total of 5 days SLA for these milestones to 0.

I will provide a start date and end date as input to fnGetDatesInRange and then for each date in this range determine how many days worth of work had been completed and how many days were left remaining to complete all the milestones. The actual burndown in output table shows how many days of work remain to complete all the milestones on each date.
Go to Top of Page
   

- Advertisement -