Skip to content

Commit 04a9f75

Browse files
authored
Merge pull request #9037 from MicrosoftDocs/users/chcomley/reports-copilot-integration
Copilot integration and improvements - Report docs
2 parents 368cf2a + 571abf1 commit 04a9f75

16 files changed

Lines changed: 1292 additions & 1643 deletions

docs/includes/ai-assistance-mcp-server-tip.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ ms.topic: include
1010
ms.custom: copilot-scenario-highlight
1111
-->
1212

13+
<!-- Anchor satisfies build validation; the real target is in the consuming article -->
14+
<a name="use-ai-assistance"></a>
15+
1316
> [!TIP]
1417
> You can [use AI to help with this task](#use-ai-assistance) later in this article, or see [Enable AI assistance with Azure DevOps MCP Server](/azure/devops/mcp-server/mcp-server-overview) to get started.
1518

docs/report/analytics/analytics-query-parts.md

Lines changed: 130 additions & 181 deletions
Large diffs are not rendered by default.

docs/report/dashboards/charts.md

Lines changed: 82 additions & 134 deletions
Large diffs are not rendered by default.

docs/report/dashboards/configure-burndown-burnup-widgets.md

Lines changed: 105 additions & 32 deletions
Large diffs are not rendered by default.

docs/report/dashboards/configure-sprint-burndown.md

Lines changed: 124 additions & 212 deletions
Large diffs are not rendered by default.

docs/report/dashboards/cycle-time-and-lead-time.md

Lines changed: 74 additions & 73 deletions
Large diffs are not rendered by default.

docs/report/dashboards/dashboard-focus.md

Lines changed: 58 additions & 50 deletions
Large diffs are not rendered by default.

docs/report/extend-analytics/aggregated-data-analytics.md

Lines changed: 94 additions & 223 deletions
Large diffs are not rendered by default.
Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
---
2-
title: Query trend data
3-
titleSuffix: Azure DevOps
4-
description: Learn how to query Analytics trend data and consume it in a client tool when working from Azure DevOps.
2+
title: Query Trend Data With OData Aggregation in Azure DevOps
3+
titleSuffix: Azure DevOps
4+
description: Learn how to query trend data in Azure DevOps using OData aggregation. Filter, group, and analyze snapshot entity sets for actionable insights.
55
ms.subservice: azure-devops-analytics
6+
ms.custom: copilot-scenario-highlight
67
ms.assetid: FEF88D72-32D7-4DE8-B11E-BCB1A491C3FC
78
ms.author: chcomley
89
author: chcomley
9-
ms.topic: tutorial
10-
monikerRange: "<=azure-devops"
11-
ms.date: 02/12/2025
10+
ms.topic: how-to
11+
monikerRange: "<= azure-devops"
12+
ms.date: 03/18/2026
13+
ai-usage: ai-assisted
1214
---
1315

14-
# Query trend data
16+
# Query trend data with OData aggregation
1517

1618
[!INCLUDE [version-lt-eq-azure-devops](../../includes/version-lt-eq-azure-devops.md)]
1719

18-
Examining trends in data and making period-over-period comparisons are important aspects of reporting and data analysis. Analytics supports these capabilities.
20+
Analytics stores daily snapshots of every work item in two entity sets: `WorkItemSnapshot` (tracks field values like state and effort) and `WorkItemBoardSnapshot` (tracks board column positions). Because each entity contains one row per work item per day, these tables grow quickly. Use [OData aggregation extensions](aggregated-data-analytics.md) to filter by date and group results before returning data to a client tool.
1921

20-
[!INCLUDE [temp](../includes/analytics-preview.md)]
21-
22-
Trend data is exposed in the WorkItemSnapshot and WorkItemBoardSnapshot entity sets. They're constructed so every work item, from the day it was created until today, exists for each day. For an organization with only one work item that was created a year ago, there are 365 rows in this entity. For large projects, these entities would be impractical to use with client tools.
23-
24-
What is the solution? Use the [Aggregation extensions](aggregated-data-analytics.md).
22+
This article shows how to build trend queries by date range and by iteration, using `$apply` with `filter`, `groupby`, and `aggregate`.
2523

26-
Using the OData Aggregation Extensions, you can return aggregated data from Azure DevOps that is conducive to reporting. For example, you could show bug trend for the month of March. Bug trends are a common and critical part of managing any project so you can put it to good use immediately.
24+
[!INCLUDE [temp](../includes/analytics-preview.md)]
2725

28-
::: moniker range=" < azure-devops"
26+
::: moniker range="< azure-devops"
2927

3028
> [!NOTE]
31-
> The examples shown in this document are based on an Azure DevOps Services URL. Substitute your Azure DevOps Server URL as needed.
29+
> The examples shown in this article are based on an Azure DevOps Services URL. Substitute your Azure DevOps Server URL as needed.
3230
3331
> [!div class="tabbedCodeSnippets"]
3432
> ```OData
@@ -37,66 +35,53 @@ Using the OData Aggregation Extensions, you can return aggregated data from Azur
3735
3836
::: moniker-end
3937
38+
[!INCLUDE [ai-assistance-mcp-server-tip](../../includes/ai-assistance-mcp-server-tip.md)]
39+
4040
## Prerequisites
4141
4242
[!INCLUDE [prerequisites-simple](../includes/analytics-prerequisites-simple.md)]
4343
4444
<a id="trend-data"></a>
4545
46-
## Construct a basic query for trend data
47-
48-
To effectively query the WorkItemSnapshot table, follow these basic requirements:
49-
* Filter the data by date.
50-
* Group the aggregation by at least the date. If not, the response includes a warning.
46+
## Query trend data by date range
5147
52-
The query to create a bug trend report looks like the following example:
48+
When you query snapshot tables, follow two requirements:
49+
50+
1. **Filter by date** — each table contains one row per work item per day, so an unfiltered query returns a very large result set.
51+
1. **Group by date** — if you omit the date grouping, the response includes a warning.
52+
53+
The following query returns a daily bug count by state for March 2016:
5354
5455
> [!div class="tabbedCodeSnippets"]
5556
> ```OData
56-
> https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}//WorkItemSnapshot?
57+
> https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItemSnapshot?
5758
> $apply=
5859
> filter(DateValue ge 2016-03-01Z and DateValue le 2016-03-31Z and WorkItemType eq 'Bug')/
59-
> groupby((DateValue,State), aggregate($count as Count))
60+
> groupby((DateValue, State), aggregate($count as Count))
6061
> &$orderby=DateValue
6162
> ```
6263
63-
It returns a result similar to the following example:
64+
Returns:
6465
6566
> [!div class="tabbedCodeSnippets"]
6667
> ```JSON
6768
> {
68-
> "@odata.context": "https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}//$metadata#WorkItemSnapshot(DateValue,State,Count)",
6969
> "value": [
70-
> {
71-
> "@odata.id": null,
72-
> "State": "Active",
73-
> "DateValue": "2016-03-01T00:00:00-08:00",
74-
> "Count": 2666
75-
> },
76-
> {
77-
> "@odata.id": null,
78-
> "State": "Closed",
79-
> "DateValue": "2016-03-01T00:00:00-08:00",
80-
> "Count": 51408
81-
> }
70+
> { "DateValue": "2016-03-01T00:00:00-08:00", "State": "Active", "Count": 2666 },
71+
> { "DateValue": "2016-03-01T00:00:00-08:00", "State": "Closed", "Count": 51408 }
8272
> ]
8373
> }
8474
> ```
8575
86-
This query produces at most `31 * (number of bug states)`. The default bug has three states:
87-
- Active
88-
- Resolved
89-
- Closed
90-
91-
At most, this query returns 93 rows no matter how many thousands of records actually exist. It provides a much more compact form of returning data.
76+
This query returns at most 31 days multiplied by the number of bug states (Active, Resolved, Closed) - 93 rows maximum, regardless of how many work items exist.
9277
93-
Let's look at a variation on this example. You want to see the bug trend for an iteration or a release that starts with one iteration and ends with another.
78+
## Query trend data by iteration
9479
95-
To construct that query, do the following example:
80+
Instead of hard-coding dates, filter by iteration and reference its start and end dates so the date range adjusts automatically. The `Iteration/EndDate eq null` check handles iterations that don't have an end date yet.
9681
9782
> [!div class="tabbedCodeSnippets"]
9883
> ```OData
99-
> https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}//WorkItemSnapshot?
84+
> https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}/WorkItemSnapshot?
10085
> $apply=
10186
> filter(WorkItemType eq 'Bug')/
10287
> filter(Iteration/IterationName eq 'Sprint 99')/
@@ -105,34 +90,52 @@ To construct that query, do the following example:
10590
> &$orderby=DateValue
10691
> ```
10792
108-
It returns a result similar to the following example:
93+
Returns:
10994
11095
> [!div class="tabbedCodeSnippets"]
11196
> ```JSON
11297
> {
113-
> "@odata.context": "https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/{version}//$metadata#WorkItemSnapshot(DateValue,State,Count)",
11498
> "value": [
115-
> {
116-
> "@odata.id": null,
117-
> "State": "Active",
118-
> "DateValue": "2016-04-04T00:00:00-07:00",
119-
> "Count": 320
120-
> },
121-
> {
122-
> "@odata.id": null,
123-
> "State": "Closed",
124-
> "DateValue": "2016-04-04T00:00:00-07:00",
125-
> "Count": 38
126-
> }
99+
> { "DateValue": "2016-04-04T00:00:00-07:00", "State": "Active", "Count": 320 },
100+
> { "DateValue": "2016-04-04T00:00:00-07:00", "State": "Closed", "Count": 38 }
127101
> ]
128102
> }
129103
> ```
130104
131-
In this query, there are two key differences. We added a filter clause to filter the data to a specific iteration and the dates are now being compared to the iteration start and end dates versus a hard-coded date.
132-
133105
> [!NOTE]
134-
> If your query on snapshot tables doesn't use aggregation, the response displays the warning: "The specified query doesn't include a `$select` or `$apply` clause which is recommended for all queries."
106+
> If your query on snapshot tables doesn't include `$apply` or `$select`, the response returns a warning. Always use aggregation with snapshot entity sets.
107+
108+
::: moniker range="azure-devops"
109+
110+
## Use AI to build trend queries
111+
112+
If you configure the [Azure DevOps MCP Server](/azure/devops/mcp-server/mcp-server-overview), you can use AI assistants to help construct and troubleshoot trend queries against snapshot entity sets.
113+
114+
### Example prompts
115+
116+
| Task | Example prompt |
117+
|------|----------------|
118+
| Bug trend query | `Write an OData trend query that shows the daily bug count by state over the last 30 days in <Contoso> project` |
119+
| Sprint snapshot | `Create an OData query against WorkItemSnapshot that shows work item counts grouped by date for the current sprint in <Contoso> project` |
120+
| Filter by iteration | `Generate an OData trend query that uses iteration start and end dates to show story point burndown in <Contoso> project` |
121+
| Board snapshot | `Write an OData query against WorkItemBoardSnapshot to track items by board column over the past two weeks in <Contoso> project` |
122+
| Optimize performance | `My WorkItemSnapshot trend query is timing out — help me add proper date filters and aggregation to improve performance in <Contoso> project` |
123+
| Period comparison | `Create an OData trend query that compares bug counts between the current sprint and the previous sprint in <Contoso> project` |
124+
| Remaining work trend | `Write an OData trend query that shows the daily sum of remaining work by area path for the current iteration in <Contoso> project` |
125+
| Detect state changes | `Create an OData snapshot query that tracks how many work items moved from Active to Resolved each day over the past 60 days in <Contoso> project` |
126+
| Scope change analysis | `Generate an OData trend query that shows the daily count of user stories added or removed from a sprint by comparing snapshot data in <Contoso> project` |
127+
128+
::: moniker-end
129+
130+
## Next step
131+
132+
> [!div class="nextstepaction"]
133+
> [OData Analytics query guidelines](odata-query-guidelines.md)
135134
136-
## Related articles
135+
## Related content
137136
138-
- [Construct aggregate data queries](aggregated-data-analytics.md) to count and analyze groups of related data.
137+
- [Aggregate work tracking data using Analytics](aggregated-data-analytics.md)
138+
- [Define basic queries using OData Analytics](wit-analytics.md)
139+
- [Construct OData queries for Analytics](../analytics/analytics-query-parts.md)
140+
- [OData Analytics query guidelines](odata-query-guidelines.md)
141+
- [OData Extension for Data Aggregation Version 4.0](https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4.0-cs01.html)

0 commit comments

Comments
 (0)