Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:34:18+00:00 2026-05-31T07:34:18+00:00

It’s been ages since I’ve worked in SQL, so apologies if this is a

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:34:19+00:00Added an answer on May 31, 2026 at 7:34 am

    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:

    SELECT        Name, Microsoft_VSTS_Scheduling_StartDate AS StartDate,
                             (SELECT        SUM(Microsoft_VSTS_Scheduling_OriginalEstimate) AS OriginalEstimateTotal
                               FROM            CurrentWorkItemView AS wi1
                               WHERE        (IterationPath IN
                                                             (SELECT        IterationPath
                                                               FROM            CurrentWorkItemView AS wi2
                                                               WHERE        (WorkItemType = 'Sprint') AND 
                                                                                         (Microsoft_VSTS_Scheduling_StartDate > wi3.Microsoft_VSTS_Scheduling_StartDate))) AND (State NOT IN ('Removed'))) 
                         AS OriginalEstimateTotal
    FROM            CurrentWorkItemView AS wi3
    WHERE        (WorkItemType = 'Sprint') AND (State <> 'Removed')
    ORDER BY StartDate
    

    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. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.