构建所有工作项的列表及其故事和功能

时间:2017-11-22 22:52:35

标签: sql tfs tfs2013

有谁知道如何使用TFS_Warehouse构建查询,输出类似于:

Feature   Story     Task                  Estimated Hours  Completed Hours  Remaining Hours
F1        S1        Write Documentation   3                2                3
F1        S1        Write Code            10               4                2
F1        S2        Create Logo           5                1                1
F1        S2        Ship Logo             7                3                3

我希望列出每个任务,然后与每个任务一起列出它的父故事和该故事的父功能。目的是汇总时间,并能够围绕功能和故事,并获得总数。我已经搜索了Microsoft文档,但还没有发现任何有用的信息。谢谢!

2 个答案:

答案 0 :(得分:0)

最简单的方法是创建工作树项查询,然后在Excel中打开查询。然后根据需要渲染格式并保存为新的Excel工作表。

您可以按照以下屏幕截图中标记的步骤进行操作。

参考:Bulk add or modify work items with Excel

enter image description here

答案 1 :(得分:0)

最终我能够创建一个我想要的查询:

use TFS_Warehouse;
-- first get the group of systemids we are interested in, either by iteration, or person, or
with systemids as (
   select system_id from DimWorkItem dwi 
   where 1=1
   --and dwi.System_AssignedTo__PersonSK=1332 -- (Russ)
   and dwi.IterationSK in(2590,2585,2593) -- Current W48, 
   --and dwi.Microsoft_VSTS_Scheduling_StartDate = 
   --and dwi.Microsoft_VSTS_Scheduling_FinishDate
   AND dwi.System_RevisedDate = CONVERT(datetime, '9999', 126) -- latest revision
)

,lvl12 as (
   select
          dwic.system_id as 'Feature System Id'
          ,dwic.System_Title + ' (' + dwic.System_WorkItemType + ') ' as Feature

          ,dwi.System_id as 'Story System Id'
          ,dwi.System_Title + ' (' + dwi.System_WorkItemType + ')' as Story

          ,wi.System_id as 'Work Item Id'
          ,wi.System_Title + ' (' + wi.System_WorkItemType + ')' as Task

          ,wi.Microsoft_VSTS_Common_Activity as Activity

          ,fwi.Microsoft_VSTS_Scheduling_OriginalEstimate as OriginalEstimate
          ,fwi.Microsoft_VSTS_Scheduling_RemainingWork as RemainingWork
          ,fwi.Microsoft_VSTS_Scheduling_CompletedWork as CompletedWork

          ,p.Alias as 'Assigned To'
          ,p.PersonSK
          ,wi.System_State

          ,iteration.IterationPath
          ,iteration.IterationSK

          ,area.AreaName

          ,wi.Microsoft_VSTS_Scheduling_StartDate StartDate
          ,wi.Microsoft_VSTS_Scheduling_FinishDate FinishDate

   FROM DimWorkItem wi
          -- used project id, found using another query
          CROSS APPLY GetWorkItemsTree('3F5639AD-05C7-4757-95D5-0DAB164E21B4', wi.system_id, N'Parent', DEFAULT) wit
          LEFT JOIN DimWorkItem dwi on dwi.WorkItemSK=wit.ParentWorkItemSK -- and dwi.System_WorkItemType='User Story'
          left join DimWorkItem dwic on dwic.WorkItemSK=wit.ChildWorkItemSK
          left join FactCurrentWorkItem fwi on fwi.WorkItemSK = wi.WorkItemSK
          left join DimPerson p on p.PersonSK = wi.System_AssignedTo__PersonSK
          left join DimIteration iteration on iteration.IterationSK = wi.IterationSK
          left join DimArea area on area.AreaSK = wi.AreaSK
   where 1=1
   AND wi.system_id in(select * from systemids)
   AND wi.System_RevisedDate = CONVERT(datetime, '9999', 126) -- latest revision
   AND wit.Level > 1
 )

select 
   lvl12.*
from lvl12
order by Feature, Story, Task