Query work tracking data using Analytics
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019
You can query your Azure DevOps work tracking data using the basic queries provided in this article. These queries address everyday needs while demonstrating various capabilities of Analytics. You can adapt most of these queries to meet your needs.
Note
The Analytics service is automatically enabled for all Azure DevOps Services. It is supported for use in production. Power BI integration and access to the OData feed of the Analytics Service are in Preview. We encourage you to use it and provide us feedback.
Note
The Analytics service is automatically installed on all new project collections for Azure DevOps Server 2020. It is supported for use in production. Power BI integration and access to the OData feed of the Analytics Service are in Preview. We encourage you to use it and provide us feedback. If you upgraded from Azure DevOps Server 2019, then you're provided with the option to install the Analytics service during upgrade.
Note
The Analytics service is in preview for Azure DevOps Server 2019. You access Analytics by enabling or installing it for a project collection. Power BI integration and access to the OData feed of the Analytics Service are in Preview. We encourage you to use it and provide us feedback.
For prerequisites and other information for getting started, see Query your work tracking data using OData Analytics. All examples are scoped to a project on Azure DevOps Services. For examples of organization-level scoping or Azure DevOps Server, see Project and organization-scoped queries.
Retrieve work item history
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItemRevisions?
$filter=WorkItemId eq {Id}
&$select=WorkItemId, Title, State
Note
The {version} value is formatted as v1.0. The latest supported version is v2.0, and the latest preview version is v4.0-preview. For more information, see OData API versioning.
Retrieve all work items for a given Iteration Path
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=Iteration/IterationPath eq '{iteration path}'
&$select=WorkItemId, Title, State
Retrieve all work items under a given Area Path
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=Area/AreaPath eq '{area path}'
&$select=WorkItemId, Title, State
Get the count of work items in each project
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$apply=groupby((Project/ProjectName), aggregate($count as Count))
This query will fail when the user doesn't have access to all the projects. Read more about project and organization-scoped queries.
Retrieve all work items for a given iteration
You can retrieve all work items for a given iteration that fall between the first day of the iteration and the last day of the iteration. Here, your query is constrained by data contained within the work tracking data.
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=Iteration/IterationPath eq '{iteration path}'
and ChangedDate ge Iteration/StartDate
and ChangedDate le Iteration/EndDate
&$select=WorkItemId, Title, State
Retrieve all work items with a specific tag
The any operator is used here because there are a collection of tags that can be associated with a work item. From a usage perspective, the format is: {Navigation Property}/any(d:d/{Field Name} {operator} {expression}). Any item not surrounded by curly brackets ({}) is a literal. There are some variations. For example, you don't have to use "d" as used in the expression above. Following this format keeps it simple.
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=Tags/any(d:d/TagName eq '{tag name}')
&$select=WorkItemId, Title, State
Retrieve all work items for a specific team
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=Teams/any(d:d/TeamName eq '{team name}')
&$select=WorkItemId, Title, State
Retrieve all work items that at one time had a field set to a specific value
This query is similar to a Work Item query that uses the Was Ever operator.
https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItems?
$filter=WorkItemType eq '{Type}'
and Revisions/any(r:r/ResolvedBy/UserName eq '{User}')
Related articles
Maklum balas
Kirim dan lihat maklum balas untuk