“工作项链接历史记录”表

可以使用 FactWorkItemHistory 和关联的维度表查询有关 bug、任务和其他工作项类型之间的链接。 若要包含有关链接的工作项的详细信息,请将 SourceWorkItemID 和 TargetWorkItemID 联接到 Dim.System_ID。

有关 SQL Server Analysis Services 多维数据集中与这些表相关联的度量值和维度的信息,请参阅使用工作项透视分析和报告工作项和测试用例数据

“工作项之间的链接”事实数据表

FactWorkItemLinkHistory 与以下维度表关联:

  • DimTeamProject

  • DimPerson

  • DimWorkItem

备注

此表包含已删除的链接。尚未删除的链接的 RemovedDate 设置为 9999 年 1 月 1 日 。删除链接时,会将已删除的日期设置为它被删除的日期和时间。可以使用 RemovedDate > GetDate() 来筛选出已删除的链接。

可以使用以下示例查询来查找以下类型的信息:

  • 已完成工作的总小时数

  • 原始估计工作

  • 剩余工作

  • 指定区域路径下的团队项目中每个用户情景的总情景点

有关用于示例查询的 Coalesce 函数的信息,请参阅 Microsoft 网站上的下列页:COALESCE (Transact-SQL)

备注

此查询假定用户情景通过子链接链接到了其他工作项。

declare @TeamProjectNodeSK int
select @TeamProjectNodeSK = ProjectNodeSK from GetProjectNodeInfoFromReportFolder(N'/TfsReports/VSTSDF/ProcessDev10')
-- This table-value function returns the ProjectNodeSK: the Surrogate Key of a team project under a certain area path.

declare @TeamProjectCollectionGuid nvarchar(36)
select @TeamProjectCollectionGuid = pc.ProjectNodeGUID from DimTeamProject p inner join DimTeamProject pc on p.ParentNodeSK = pc.ProjectNodeSK where p.ProjectNodeSK = @TeamProjectNodeSK
-- This query finds the team project collection GUID by joining TeamProject.ParentNodeSK to TeamProject.ProjectNodeSK

select 
     wi.System_Title
    ,wi.System_Id
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_CompletedWork), 0) as Total_CompletedWork -- Finds the total number of hours of completed work.
   ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_OriginalEstimate), 0) as Total_OriginalEstimate --Finds the total number of hours of original estimate.
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_RemainingWork), 0) as Total_RemainingWork --Finds the total number of hours of remaining work.
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_StoryPoints), 0) as Total_StoryPoints --Finds the total story points.
from
    DimWorkItem wi
cross apply
    GetWorkItemsTree(@TeamProjectCollectionGuid, wi.System_Id, N'Child', DEFAULT) wit 
left join        
    FactCurrentWorkItem cwi_child
        on cwi_child.WorkItemSK = wit.ChildWorkItemSK
where
    wi.TeamProjectSK = @TeamProjectNodeSK 
    and wi.System_WorkItemType = N'User Story'
    and wi.System_RevisedDate = CONVERT(datetime, '9999', 126)--The revised date of the work item is equal to today.
    and wi.System_State = N'Active'
group by wi.System_Id, wi.System_Title
order by wi.System_Id

请参见

概念

使用工作项透视分析和报告工作项和测试用例数据

Visual Studio ALM 的关系型仓库数据库的表引用

其他资源

定义自定义链接类型