“工作项链接历史记录”表
通过使用 FactWorkItemLinkHistory 和关联的维度表,您可以查询 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 的关系型仓库数据库的表引用