如何在TFS Cloud编写查询统计近2个月每周关闭用户故事的故事点?
Absolutely! You can totally build this query and visualize it as a bar chart in your TFS Cloud (Azure DevOps Services) dashboard. Here's a step-by-step guide to make it happen:
Step 1: Create a Targeted Work Item Query
- Navigate to Boards > Queries in your TFS Cloud project.
- Create a new Flat query (this works best for aggregation scenarios like this).
- Set up these filter criteria:
Work Item Type= User StoryState= ClosedClosed Date>= @Today - 60 (this covers the past 2 months; use@Today - 56for an exact 8-week window)- Optional:
Story Points> 0 (to exclude user stories without story point values)
- Add the Closed Date and Story Points columns to your query (you can add others if needed, but these two are essential).
Step 2: Group & Aggregate Data by Week
Once your query returns the right set of user stories:
- Click the Group by button at the top of the results table.
- Select Closed Date, then choose Week from the submenu (this will cluster all closed items into weekly buckets).
- Next, click the Aggregate button, select Story Points, and pick Sum from the options. This will calculate the total story points for each week.
Step 3: Add the Bar Chart to Your Dashboard
Now it’s time to turn this aggregated data into your desired visualization:
- Open your target dashboard and click the Edit button in the top-right corner.
- Click Add widget, then search for and select the Chart widget.
- Configure the widget:
- Data source: Choose the query you just created.
- Chart type: Select Bar chart.
- X-axis: Pick
Closed Date (Week)to represent each week as a bar. - Y-axis: Select
Sum of Story Pointsto show the total story points per week. - Title: Give it a clear name like "Weekly Closed User Story Story Points (Past 2 Months)".
- Save the widget and exit edit mode — your 8-bar chart should now be live on the dashboard!
Quick Notes
- Ensure your user stories have filled-in Story Points values; blank entries won’t be included in the sum.
- You can adjust the week start day (e.g., Monday vs. Sunday) via the group-by settings in your query if needed.
- If you notice gaps in weeks where no user stories were closed, the chart will still display those weeks with a value of 0 (depending on your widget settings).
内容的提问来源于stack exchange,提问作者Roy
相关产品推荐
相关产品推荐

