共用方式為


工作項目連結記錄資料表

您可以使用 FactWorkItemLinkHistory 資料表和關聯的維度資料表,查詢 Bug、工作和其他類型之工作項目間的連結。 若要併入已連結之工作項目的詳細資料,請將 SourceWorkItemID 和 TargetWorkItemID 加入 Dim.System_ID。

如需在[SQL分析服務方塊]裡與這些測量及維度相對應資料表的的詳細資訊,請參閱 使用工作項目透視圖分析和報告工作項目與測試案例資料

工作項目間之連結的事實資料表

FactWorkItemLinkHistory 與下列維度資料表相關聯:

  • DimTeamProject

  • DimPerson

  • DimWorkItem

注意事項注意事項

此資料表包含已移除的連結。尚未移除之連結的 RemovedDate 會設為 Jan 1, 9999。移除連結時,移除日期會設為其移除日期和時間。您可以使用 RemovedDate > GetDate() 篩選出已移除的連結。

您可以使用下列範例查詢,來尋找下列類型的資訊:

  • 完成工作的總時數

  • 原始估計工作

  • 剩餘工作

  • 在指定區域路徑下,Team 專案中每個使用者劇本的劇本總點數

如需範例查詢中所使用之 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 的關聯式倉儲資料庫建立報表

其他資源

定義自訂連結類型