It’s been ages since I’ve worked in SQL, so apologies if this is a dumb question.
I’m working with a TFS database, and I’m trying to do a query report against it to get the sum of all the “OriginalEstimate” field, for items in the current sprint iteration and forward.
i.e., if the data was laid out like this:
Sprint Name | Original Estimate Total
Sprint #1: | 10
Sprint #2: | 20
Sprint #3: | 30
Sprint #4: | 40
I’d like to get a data set returned that looks like this:
Sprint Name | Original Estimate Total
Sprint #1: | 90
Sprint #2: | 70
Sprint #3: | 40
Sprint #4: | 0
First off, I don’t even know if the above is possible using SQL. Let me know if not. 🙂
Where things get hairier to start with, is me understanding how to do this in TFS SQL server table structure. I can’t modify the structure, so any idea on how to accomplish this is greatly appreciated.
If you’re unfamiliar with TFS’s database layout, here’s a quick table summary, snipped down and renamed a bit to make it easier to grok:
(Table) Iteration
-----------------
IterationName
IterationGuid
(Table) WorkItem
----------------
ID
Name
IterationGUID // Relates to Iteration table, above
StartDate
OriginalEstimate // The field I care about, only valid on 'Task' in our case.
WorkItemType // Used to distinguish the type, for our purposes assume only 'Task' and 'Sprint' exist
Quick description:
“WorkItem”‘s in TFS are everything from backlogs, tasks, to ‘sprints’. A ‘sprint’ is simply an entry that contains a StartDate and an EndDate for accounting your sprint start/ends, and also links to the Iteration that all the tasks will as well.
So, what I want is the data mentioned above, grouped by the Sprint’s “Name”, ordered by the Sprint’s “StartDate”, that is the forward-sum of all sprints ahead of it.
And this is where I want to blow my brains out.
If this is possible and I simply need to do more reading, please let me know what to look up. I can’t seem to make this fly with subqueries, but perhaps I’m simply not using them right.
Thanks!
So, these answers all helped me steer towards what I needed to do, but none was complete enough on it’s own. Here’s the final solution I found:
Ideally I’d like to move this query to a MDX query, but I haven’t the foggiest. If anyone has any input on that, that’d be great. 🙂