How to query TFS for the "x" most recent iterations, for charting purposes? - tfs

I have a TFS query that pulls in data from recent sprints, in order to display a chart on our dashboard. However, as documented:
When a chart contains more than seven items within the data series, values in the eight-plus items are consolidated into a set labeled "other"
This is exactly what happens with us. The first few Iterations on the chart are static, and as every Iteration passes by, the "Other" row increases.
How can I alter my query to only pull in the last seven iterations? I can't do something like Iteration ID >= #Current Iteration - 6 because #Current Iteration is supported only for Iteration Path, not Iteration ID.

There isn't any way to achieve this through in TFS for now.
However for VSTS, it's added now.
The deployment of this feature to all VSTS accounts is now complete.
You can find full details in our Release Notes
(https://learn.microsoft.com/en-us/vsts/release-notes/2018/mar-05-vsts#query-work-across-the-iteration-schedule-with---currentiteration).
TFS customers can look forward to the feature in a future feature
update.
Source Link
Query work across the iteration schedule with +/- #CurrentIteration
The #CurrentIteration macro that helps your team track work based on your iteration schedule now supports integer offset. Easily keep tabs on the work that didn’t get closed with #CurrentIteration - 1, or look ahead at the work planned for future iterations with #CurrentIteration + 1. See the #CurrentIteration post on the Microsoft DevOps Blog for more information.
Update:
Logical expression: Work Item Type = any And State= any AND (Iteration= CurrentIteration OR Iteration= CurrentIteration-1 OR...)

Related

Sort TFS Query By Itaration Start Date

I have TFS/AzureDevOps query which is sorted by Iteration Path .
I need to sort it by Iteration Start Date.
I dont see any option on the Sorting Page or in the query page to sort like this.
I tried sorting by iteration ID but the iteration were not created in order .
WIQL Code
SELECT
[System.IterationPath],
[Prod.Versions],
[System.Id],
[Prod.Territory],
[Prod.Customer],
[System.Title],
[System.AssignedTo],
[System.State]
FROM workitems
WHERE
[System.TeamProject] = #project
AND [System.WorkItemType] = 'Feature'
AND [Prod.Versions] >= '9.0'
AND [System.IterationPath] <> 'Machine'
AND [System.AreaPath] UNDER 'Machine\Development'
ORDER BY [System.IterationId],
[System.Id]
i would like it to be ordered like the following (this is from the setting page of the project in AzureDevops Server 2019 ):
We have adopted a naming convention for our iterations that uses the start date of the iteration as the name in order to achieve this.
So the iterations are named like:
2019.08.12
2019.08.26
not ideal, and I would love to see a option to include the iteration's start date a column for this very reason. Hopefully we will see a better answer soon.
Sorry, TFS work item query not support to filter Iteration using Start/End Dates.
There is a similar question here: TFS show iteration Start and End Date on PBI
Since using a name contain iteration date is not a solution for you. As another workaround, you could try get Iterations in specific Start/End dates using TFS API. Some thing maybe helpful for your reference.
Besides, in each collection database there is a table called "tbl_nodes" that holds the start-date and the end-date.
Writing a warehouse adapter that actually picks up these dates and saves them to the warehouse. Note do not write or change anything directly in database which may lose official support.
For query work item using Iteration Start/End Dates scenario, please submit it to User Voice site at: https://developercommunity.visualstudio.com/spaces/21/visual-studio-team-services.html?type=idea Microsoft engineers will evaluate any feature request seriously.

No longer able to aggregate by "Sum" for Dashboard / using "Chart for Work Items"

Working on updating the Dashboard in TFS for a new sprint. I have a chart which shows a "Chart for Work Items" widget with a "Stacked area" chart of all the stories which is stacked by "state". Then, I have the stories plotted using "Aggregation" and "sum" along with "Effort". This worked in the previous sprint. For the current sprint the Configuration area doesn't show "sum" anymore just "count". Showing number of stories isn't as meaningful as number of story point (effort).
(I thought perhaps the stories on my current sprint were generated with a different template and this is what broke the query or configuration tool for the plot. But I moved a story from previous sprint and let it be the only one in the current sprint and that did not work.)
The current version of TFS I'm running is "Version 15.117.27024.0"
Previous sprint (works)
Current sprint (does not allow selecting Sum)
The problem is that you didn't select the appropriated Column Options which are available for Sum action.
Just check the query "Sprint9", make sure you have selected the columns such as: Effort, Remaining work, Completed work etc which are available for Sum action.
In VSTS Column Options aren't just what columns you see on the query page - they reflect fields can be used by the query too.
Open the Column Options menu:
Select Add Column and select field relevant, i.e, Story Points:

How to get power charts and reports for tfs

I want to get some different reports and charts from Tfs activities and history (most based on task tags and assigned users). for example after 3 monthes I want to know how many hours a user moved her tasks to next iteration, ...
Is there any tools for this?
No such a tool can exactly achieve that. There is an extension Team Capacity Management, but seems it's not apply for you.
If you want to know how many hours a user moved her tasks to next iteration, then you need to get the planned hours then subtract the completed hours in current iteration. Alternatively you can add tags on the work items which moved to the next iteration, then create a query which filter by the tags to get the sum of hours.
e.g.:
Create a query 'RemainingWork' with the column Assigned
to and Remaining Work added in "next iteration" (e.g.: iteration
2 here) to filter the moved work items from pervious iteration with the tag.
Save it in Shared queries
Add Chart for Work items widget in your project dashborad, then
configure the widget. Then you can see the hours a user moved tasks
to next iteration in the chart:

Is there any way to identify item moved to specific iteration in TFS?

New items created can be easily found out by having query created on "Created Date" field. Is there any way to identify TFS items whose iteration have been changed from lets say iteration 11 to iteration 12?
If you just want to know the items under a specific iteration, there is a filed called Iteration Path, you can directly specify the Iteration such as below picture.
Update
There is also a #CurrentIteration under Iteration Path. https://www.visualstudio.com/en-us/news/2015-mar-10-vso
However, you may have to use TFS2015 and VS 2015 or VS 2013 Update 5. For TFS2012, I'm afraid that there is not such a macro. See Is there a TFS query macro for the current iteration?
There is no way to get this information via query for now. If you do need these information, you can get it by TFS API. The workflow would be get all the workitems under "Iteration 12" by WIQL and then check the history of these workitems and record the workitems which the previous iteration path is "Iteration 11".

How can I get a report of all work items added to an iteration after a given date?

I need to produce a report, similar to the Unplanned Work report included with the MS Agile Process Template, but which lists me all work items which were added to an iteration after a given date.
The work item may have already been created before that date, so I can't used the created date.
Can anyone give any guidance on how I can go about this? If I can achieve it in Excel then that would be perfect...
Thanks.
Ok, took some work. Interesting enough though to put some effort in it ...
First screenshot is a Pivot table connected to the Analysis Cube. The most left colum shows the ID of a workitem. The second column shows the ChangeDate. In the row header I have included every iteration that I am interested in. What you see happening in the Excel sheet is items moving from one sprint to the other. For example, workitem 27 was created for iteration 1 at 14-3-2011. On 13-4-2011 it was moved to iteration 2. On 12-5-2011 it was moved to iteration 3. etc.
If I narrow down the filter to a specific iteration I actually see items entering the iteration and leaving the iteration. If I also change the ChangeDate filter, I can focus on items entering after a specific date, as you requested. Again, you can see item 27 enter iteration 2 at 13-4 and leave at 12-5. You can juggle around with the columns to get the view you want.
Finally, the options I used to get this view from TFS.
Hope this exceeds your expectations :-)

Resources